nodejs nodemailer中间件

时间:2021-11-03 21:13:11

var stransporter = nodemailer.createTransport({
host:smtp-163.com', //适合163
secureConnection: true, // use SSL
port: 465, // port
auth: {
user: 'bsspirit@gmail.com',
pass: 'xxxxxxxxx'
}
}); function ssl(){
var mailOptions = {
from: 'bsspirit ',
to: 'xxxx@163.com',
subject: 'SSL Email',
html: 'Hello world'
}
return mailOptions;
} stransporter.sendMail(ssl(), function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});