Skip to content

Instantly share code, notes, and snippets.

@omartrigui
Created April 21, 2017 22:40
Show Gist options
  • Save omartrigui/444625f82fa8f9e2ba21db52defb3885 to your computer and use it in GitHub Desktop.
Save omartrigui/444625f82fa8f9e2ba21db52defb3885 to your computer and use it in GitHub Desktop.
Quick sample - Send e-mails with Node.JS
var nodemailer = require('nodemailer');
var smtpConfig = {
host: 'domain.com',
port: 587,
auth: {
user: 'user@domain.com',
pass: 'password'
}
};
var transporter = nodemailer.createTransport(smtpConfig);
var mailOptions = {
from: 'user@domain.com',
to: 'receiver@somedomain.com',
subject: 'Test email',
text: 'this is some text',
html: '<b>Hello world ✔</b>'
}
transporter.sendMail(mailOptions, function(error, info) {
if (error) console.log(error);
console.log(info);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment