var nodemailer = require("nodemailer");
var transport = nodemailer.createTransport("SMTP", {
host: "smtp.qq.com",
secureConnection: true, // use SSL
port: 465, // port for secure SMTP
auth: {
user: "yjk99@99.com",
pass: "xxxxxxx"
}
});
transport.sendMail({
from : "11111111@qq.com",
to : "22222222@qq.com",
subject: "邮件主题",
generateTextFromHTML : true,
html : "<p>这是封测试邮件</p>"
}, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
transport.close();
});
转自:https://blog.gaoqixhb.com/p/53fc1e3991d7c21b313ff981