Skip to content

Instantly share code, notes, and snippets.

@matthewepler
Last active October 29, 2016 02:30
Show Gist options
  • Save matthewepler/d272d70ae486eb969cf36e8450f03ba3 to your computer and use it in GitHub Desktop.
Save matthewepler/d272d70ae486eb969cf36e8450f03ba3 to your computer and use it in GitHub Desktop.
const nodemailer = require('nodemailer');
function sendMail() {
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'ggdb.info@gmail.com',
pass: '<password>'
}
});
const mailOptions = {
from: 'ggdb.info@gmail.com',
to: email,
subject: 'test email',
text: 'test test'
};
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
console.log("Error while sending email.", error);
}
if (info) {
console.log("info from sendMail: ", info);
}
console.log('email sent.');
});
}
sendMail();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment