Created
February 24, 2017 01:09
-
-
Save jerryzhang222/59f501558c387b618a08d5135980aea0 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
const nodemailer = require('nodemailer'); | |
const smtpConfig = { | |
host: 'smarthost.yahoo.com', | |
port: 25, | |
secure: false, // upgrade later with STARTTLS | |
auth: { | |
user: 'jerryzhang@yahoo.com', | |
pass: 'pass' | |
} | |
}; | |
// create reusable transporter object using the default SMTP transport | |
const transporter = nodemailer.createTransport({ smtpConfig }); | |
// setup email data with unicode symbols | |
const mailOptions = { | |
from: '"Jerry Zhang" <jerryzhang@yahoo-inc.com>', // sender address | |
to: 'jerryzhang@yahoo-inc.com', // list of receivers | |
subject: 'Hello ✔', // Subject line | |
text: 'Hello world ?', // plain text body | |
html: '<b>Hello world ?</b>' // html body | |
}; | |
// send mail with defined transport object | |
transporter.sendMail(mailOptions, (error, info) => { | |
if (error) { | |
return console.log(error); | |
} | |
console.log('Message %s sent: %s', info.messageId, info.response); | |
return [null, info.response]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment