Skip to content

Instantly share code, notes, and snippets.

@ff6347
Created May 31, 2022 08:57
Show Gist options
  • Save ff6347/846a725fa608668c3aac311e445515b3 to your computer and use it in GitHub Desktop.
Save ff6347/846a725fa608668c3aac311e445515b3 to your computer and use it in GitHub Desktop.
simple inbucket setup with nodemailer
version: '3.4'
services:
mail:
image: inbucket/inbucket:latest
environment:
NODE_ENV: production
ports:
- 9000:9000
- 2500:2500
- 1100:1100
//@ts-check
console.log("hello world");
// nodemailer setup for sending emails
import { createTransport } from "nodemailer";
const transporter = createTransport({
host: "localhost",
port: 2500,
auth: {
user: "admin",
pass: "123456"
}
});
const mailOptions = {
from: "me@example.com",
to: "me@inbucket.com",
subject: "Sending Email using Node.js",
text: "That was easy!"
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error);
} else {
console.log("Email sent: " + info.response);
}
});
{
"name": "inbucket-test",
"version": "0.1.0",
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "ff6347 <hash@ff6347.email>",
"license": "MIT",
"dependencies": {
"nodemailer": "6.7.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment