Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Created April 29, 2022 13:50
Show Gist options
  • Save alphaolomi/f262ccb4d3e2b86127a98fac67dd1b1c to your computer and use it in GitHub Desktop.
Save alphaolomi/f262ccb4d3e2b86127a98fac67dd1b1c to your computer and use it in GitHub Desktop.
Test Node mailer smtp transaport
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