我上面有node.js网站的Digital Ocean小滴。站点有联系表,我设法使用nodemailer在服务器端工作。 邮件发送功能的代码如下:
sendMailOverHotmail(mailOptions, errorCb, successCb) {
const transport = nodemailer.createTransport({
service: "Hotmail",
auth: {
user: "xxxxxxxx@hotmail.com",
pass: "password"
}
});
transport.sendMail(mailOptions, (error, info) => {
// verify connection configuration
/* transport.verify(function (error, success) {
if (error) {
console.log(error);
} else {
console.log('Server is ready to take our messages ', success);
}
}); */
if (error) {
console.log('Error while sending mail: ' + error); //Error: Missing credentials for "LOGIN"
errorCb(error);
} else {
console.log('Message sent: %s', info.messageId);
}
transport.close();
successCb(info);
});
}
一切正常,但最近它停止发送带有错误的信件:
错误:缺少“登录”的凭据
不知道发生了什么更改,由谁负责-hotmail,nodemailer或我自己。需要对此事有任何想法,谢谢!!