小编Bur*_*han的帖子

使用Mandrill作为SMTP提供程序时的身份验证错误

我试图在我的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);
        }
    });
};

};
Run Code Online (Sandbox Code Playgroud)

这就是我得到的错误

{ [AuthError: Invalid login - 435 4.7.8 Error: authentication failed:]
    name: 'AuthError',
        data: '435 4.7.8 Error: authentication failed:',
    stage: 'auth' }
Run Code Online (Sandbox Code Playgroud)

email node.js nodemailer

4
推荐指数
1
解决办法
5754
查看次数

标签 统计

email ×1

node.js ×1

nodemailer ×1