gpt4 book ai didi

node.js - 使用 Mandrill 作为 SMTP 提供程序时的身份验证错误 nodemailer

转载 作者:搜寻专家 更新时间:2023-10-31 23:02:15 26 4
gpt4 key购买 nike

我正在尝试在我的 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' }

最佳答案

我遇到了类似的问题。在我的例子中,身份验证错误是因为 mandrill 不接受您的 mandrill 帐户密码作为 smtp 身份验证密码,而是您可以在仪表板上生成的 api key 。用户名与您的帐户用户名相同。产生误解的原因可能是 mandrill 主页上的示例,但在 SMTP 和 API 凭据页面(登录后)下明确提到 smtp 密码是一个 api key 。

希望这对您有所帮助。

关于node.js - 使用 Mandrill 作为 SMTP 提供程序时的身份验证错误 nodemailer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24089327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com