Email Gmail smtp SASL身份验证

Email Gmail smtp SASL身份验证,email,smtp,gmail,postfix,two-step-verification,Email,Smtp,Gmail,Postfix,Two Step Verification,我使用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://account

我使用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
/etc/postfix/sasl/sasl\u passwd

[smtp.gmail.com]:587 admin@mydomain.com:application_password
这就是我使用sendmail的方式:

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

有什么想法吗?谢谢

允许不太安全的应用程序:如果不使用两步验证,您可能需要允许不太安全的应用程序访问您的帐户


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

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

  • 您可能需要访问“绕过”验证码,这将启用帐户访问并使所有内容正常工作。

    如果您使用2FA怎么办?@qodeninja在这种情况下,您需要创建一个可用于postfix的应用程序密码。我还面临使用smtp.gmail.com的posix配置中的身份验证问题。5月7日15:59:32 apurb-ThinkPad-E470 postfix/smtp[10589]:4CC0728214FB:to=,relay=smtp.gmail.com[64.233.186.109]:587,delay=896,delays=894/0.07/1.7/0,dsn=4.7.8,status=deferreded(SASL身份验证失败;服务器smtp.gmail.com[64.233.186.109]说:535-5.7.7.8用户名和密码不接受。更多信息请访问535.7.7.8 T7SM92499QTE.74-GSP)你知道如何解决这个问题吗?你有没有找到解决办法?我得到了相同的错误,我正在使用我的应用程序特定的密码,我在我的主帐户上启用了2FA。
    sendmail -v ...
    From: admin@mydomain.com
    Subject: Test
    This is a test mail
    .