var nodemailer = require('nodemailer');
// one time action to set up SMTP information
nodemailer.SMTP = {
host: 'smtp.example.com'
}
// send an e-mail
nodemailer.send_mail(
// e-mail options
{
sender: 'me@example.com',
to:'you@example.com',
subject:'Hello!',
html: '<p><b>Hi,</b> how are you doing?</p>',
body:'Hi, how are you doing?'
},
// callback function
function(error, success){
console.log('Message ' + success ? 'sent' : 'failed');
}
);
简单吧,详细的库安装和更详细的使用方法见