Skip to content

Instantly share code, notes, and snippets.

@shivasurya
Created September 21, 2014 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shivasurya/e284113fa6bef4028fb8 to your computer and use it in GitHub Desktop.
Save shivasurya/e284113fa6bef4028fb8 to your computer and use it in GitHub Desktop.
nodemailer library - nodemailer
var nodemailer = require("nodemailer");
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: "username@gmail.com",
pass: "########################"
}
});
smtpTransport.sendMail({
from: "S Shivasurya <s.shivasurya@gmail.com>", // sender address
to: "S Shivasurya <someone@someone.com>", // comma separated list of receivers
subject: "Mail from Nodemailer", // Subject line
text: "Hello world - this mail is sent from nodemailer library" // plaintext body
}, function(error, response){
if(error){
console.log(error);
}else{
console.log("Mail sent: " + response.message);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment