Created
April 21, 2017 22:40
-
-
Save omartrigui/444625f82fa8f9e2ba21db52defb3885 to your computer and use it in GitHub Desktop.
Quick sample - Send e-mails with Node.JS
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
var nodemailer = require('nodemailer'); | |
var smtpConfig = { | |
host: 'domain.com', | |
port: 587, | |
auth: { | |
user: '[email protected]', | |
pass: 'password' | |
} | |
}; | |
var transporter = nodemailer.createTransport(smtpConfig); | |
var mailOptions = { | |
from: '[email protected]', | |
to: '[email protected]', | |
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