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: "[email protected]",
pass: "xxxxxxx"
}
});
transport.sendMail({
from : "[email protected]",
to : "[email protected]",
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
时间: 2024-11-08 19:40:43