我正在尝试在我的 nodejs 应用程序中使用 nodemailer 发送电子邮件。我尝试使用 gmail 发送,一切正常,但是当我使用 Mandrill 作为我的 SMTP 提供程序时,我收到了身份验证错误。
这是我的代码:
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Mandrill",
auth: {
user: "username@mydomain.com",
pass: "*****"
}
});
module.exports.sendEmail = function(to, subject, body, callback){
smtpTransport.sendMail({
from: "username@mydomain.com",
to: to,
subject: subject,
html: body
}, function(error, response){
if(error){
console.log(error); callback(error, response);
}else{
callback(null, response);
}
});
};
};
这就是我得到的错误
{ [AuthError: Invalid login - 435 4.7.8 Error: authentication failed:]
name: 'AuthError',
data: '435 4.7.8 Error: authentication failed:',
stage: 'auth' }