Created
May 31, 2022 08:57
-
-
Save ff6347/846a725fa608668c3aac311e445515b3 to your computer and use it in GitHub Desktop.
simple inbucket setup with nodemailer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
mail: | |
image: inbucket/inbucket:latest | |
environment: | |
NODE_ENV: production | |
ports: | |
- 9000:9000 | |
- 2500:2500 | |
- 1100:1100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@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); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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