Created
May 5, 2017 19:39
-
-
Save djom202/76d5981bf9d651d1114ddb06717acb69 to your computer and use it in GitHub Desktop.
Sending an email with Nodejs
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
var nodemailer = require('nodemailer'); | |
exports.send = function(){ | |
var mailTransport = nodemailer.createTransport('smtps://user%40gmail.com:pass$@smtp.gmail.com'), | |
email = 'user@gmail.com', | |
mailOptions = { | |
from: '"Firebase Database Quickstart" <noreply@firebase.com>', | |
to: email, | |
subject: 'New star!', | |
text: 'One of your posts has received a new star!' | |
}; | |
return mailTransport.sendMail(mailOptions).then(function() { | |
console.log('New star email notification sent to: ' + email); | |
}).catch(function(error) { | |
console.log('Failed to send weekly top posts email:', error); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment