【问题标题】:nodemailer with virtualmin and postfix - authentication failed带有virtualmin和postfix的nodemailer - 身份验证失败
【发布时间】:2020-01-26 16:02:45
【问题描述】:

我正在使用虚拟分钟。我有一个有效的电子邮件帐户 no-reply@mydomain.com 我可以通过 webmin / virtual min 登录并发送电子邮件。

现在我想使用 nodemailer 从 node.js 发送邮件。

顺便说一句,这也适用于命令行。

mail -s "testing email" mygmail@gmail.com < /dev/null

这是我的 nodemailer 配置:

{
"smtp" : {
  "host": "localhost",
  "secure": false,
  "auth": {
    "user": "no-reply@mydomain.com",
    "pass": "mypass"
  },
  "tls": {
    "rejectUnauthorized": false
  },
  "debug" : true
},
"from" : "Resourceful Network <no-reply@resourcefulnetwork.nl>"
}

我在后缀配置文件中找到了以下配置:

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may

这都是由虚拟最小值设置的。

我收到这个错误

Error: Invalid login: 535 5.7.8 Error: authentication failed: authentication failure
code: 'EAUTH',
response: '535 5.7.8 Error: authentication failed: authentication failure',
responseCode: 535,
command: 'AUTH PLAIN'

我 100% 确定密码正确。

如果我在 nodemailer 配置中设置 "secure" : true 我会收到此错误

errno: 'ECONNREFUSED',
code: 'ESOCKET',
syscall: 'connect',
address: '127.0.0.1',
port: 465,

所以这似乎不是要走的路。

不确定要使用什么登录协议。我需要设置authMethod 吗? 安全还是不安全?

【问题讨论】:

    标签: node.js email nodemailer postfix-mta


    【解决方案1】:

    我可以通过从 nodemailer 配置中删除身份验证来解决此问题。 我现在意识到smtpd_recipient_restrictions = permit_mynetworks 意味着本地主机上的任何人都被自动允许发送。并且以某种方式仍然提供(正确的)用户名+密码出错了?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-20
      • 2018-12-22
      • 1970-01-01
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      相关资源
      最近更新 更多