Created
April 29, 2022 13:50
-
-
Save alphaolomi/f262ccb4d3e2b86127a98fac67dd1b1c to your computer and use it in GitHub Desktop.
Test Node mailer smtp transaport
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
import { createTransport } from "nodemailer"; | |
const smtpConnection = createTransport({ | |
host: "smtp-relay.sendinblue.com", | |
port: 587, | |
auth: { | |
user: process.env.SMTP_USER || "", | |
pass: process.env.SMTP_PASSWORD || "", | |
}, | |
}); | |
var message = { | |
from: "[email protected]", | |
to: "[email protected]", | |
subject: "Message title", | |
text: "Plaintext version of the message", | |
html: "<p>HTML version of the message</p>", | |
}; | |
smtpConnection.sendMail(message, function (err, info) { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log(info); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment