无法使用nodemailer和postfix发送邮件

时间:2018-04-05 17:40:59

标签: node.js smtp nodemailer

我在OVH中有一个VPS,它的ubuntu。我在那里安装了postfix,我可以直接从终端发送电子邮件(使用mail <addres@host>)。

我正在尝试使用node.js应用程序发送电子邮件,而且我经常收到Error: Invalid login: 535 5.7.8 Error: authentication failed: authentication failure

节点代码:

let transporter = nodemailer.createTransport({
    host: 'localhost',
    port: 25,
    auth: {
        user: 'systemUser', - should it be actual linux user?
        pass: 'systemUserPassword'
    },
    tls:{
        rejectUnauthorized: false
    }
});
transporter.verify(function (error, success) {
    if (error) {
        console.log(error)
    }
    else {
        console.log("success")
    }
})

2 个答案:

答案 0 :(得分:0)

自从我对常规SMTP / Sendmail做任何事情以来已经有一段时间了。您是否尝试过使用Sendmail传输代替常规的SMTP?

https://nodemailer.com/transports/sendmail/

答案 1 :(得分:0)

您可能会在这里找到答案:https://stackoverflow.com/a/54103349/9767510

我会在这里发布它,但是愚蠢的规则不喜欢它。我花了一些时间才弄清楚这一点,而且从来没有得到正确的答案。而且我发现所有这些帖子都没有提出解决方案(但是mod乐于以任何一种方式删除答案-这无济于事,并且适得其反)。人们只想要答案。

另一条评论甚至什么也没做,只留下了。具有讽刺意味的。

相关问题