Skip to content

Instantly share code, notes, and snippets.

@JonathanZWhite
Last active March 27, 2017 22:37
Show Gist options
  • Save JonathanZWhite/6e7bd8dc44ef6da2e14e9340be779c71 to your computer and use it in GitHub Desktop.
Save JonathanZWhite/6e7bd8dc44ef6da2e14e9340be779c71 to your computer and use it in GitHub Desktop.
var nodemailer = require('nodemailer');
const subscribe = {
send: function(name, service) {
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'your gmail username',
pass: 'your gmail password'
},
}, {
from: 'Sender Name <[email protected]>',
});
const message = {
to: '"Your name" <[email protected]>',
subject: 'Some subject line',
text: 'This is the body of your email. Use string concat to add variables in here',
};
transporter.sendMail(message, function (error, info) {
if (error) {
console.log('Err', error.message);
return;
}
console.log('Message sent successfully 🔥');
});
},
}
module.exports = subscribe;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment