-
-
Save Kumpon-Sotsukpiam/7ccbbfbd2a9723ca47501fced74758a7 to your computer and use it in GitHub Desktop.
Nodemailer Example
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
// main.js | |
const nodemailer = require('nodemailer'); | |
// setup mail transporter service | |
const transporter = nodemailer.createTransport({ | |
service: 'hotmail', | |
auth: { | |
user: '[email protected]', // your email | |
pass: 'password' // your password | |
} | |
}); | |
// setup email data with unicode symbols | |
const mailOptions = { | |
from: '[email protected]', // sender | |
to: '[email protected]', // list of receivers | |
subject: 'Hello from sender', // Mail subject | |
html: '<b>Do you receive this mail?</b>' // HTML body | |
}; | |
// send mail with defined transport object | |
transporter.sendMail(mailOptions, 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