4

我正在使用 postfix 通过 gmail 使用应用程序的密码发送电子邮件(已激活两步验证)。

每次我使用 sendmail 命令测试发送邮件时,都会收到以下错误:

Action: delayed
Status: 4.7.14
Diagnostic-Code: X-Postfix; delivery temporarily suspended: SASL authentication
failed; server smtp.gmail.com said: 534-5.7.14
<https://accounts.google.com/signin/continue?...> Please log in via your web browser and?534-5.7.14 then try again.?534-5.7.14

这是我的后缀配置:

主文件

myorigin = /etc/mailname
mydestination = mydomain.com, localhost.fr, localhost
relayhost = [smtp.gmail.com]:587

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

/etc/postfix/sasl/sasl_passwd

[smtp.gmail.com]:587 admin@mydomain.com:application_password

这就是我使用 sendmail 的方式:

sendmail -v ...
From: admin@mydomain.com
Subject: Test
This is a test mail
.

有任何想法吗 ?谢谢 !

4

2 回答 2

5

对于遇到相同情况的任何人:

  1. 使用应用专用密码
  2. 在您的帐户上启用 2FA
  3. 看到“交付暂时暂停:SASL 身份验证失败;服务器 smtp.gmail.com[173.194.68.109] 说:534-5.7.9 请使用您的网络浏览器登录,然后在您的日志中重试

您可能需要访问https://accounts.google.com/DisplayUnlockCaptcha以“绕过”验证码,这将启用帐户访问权限并使一切正常。

于 2020-02-23T23:22:13.613 回答
4

允许安全性较低的应用:如果您不使用两步验证,您可能需要允许安全性较低的应用访问您的帐户。

在此处输入图像描述

于 2018-07-24T13:43:00.847 回答