Created
May 22, 2018 16:26
-
-
Save sagardere/ee6e1a0a3cebbc3fc5405949ce2b305a to your computer and use it in GitHub Desktop.
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'); | |
//send mail using nodemailer via gmail service | |
var transporter = nodemailer.createTransport({ | |
service: 'gmail', | |
auth: { | |
user: 'yourEmail', | |
pass: 'yourPassword' | |
} | |
}); | |
var mailOptions = { | |
from: 'mail Id of From', | |
to: 'mail Id to To', | |
subject: 'Sending Email using Node.js', | |
text: 'That was easy!', | |
text: 'Hello world?', // plain text body | |
html: '<b>Hello world?</b>' | |
}; | |
transporter.sendMail(mailOptions, function(error, info){ | |
if (error) { | |
console.log(error); | |
} else { | |
console.log('Email sent: ' + info.response); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment