【问题标题】:Gmail smtp SASL authenticationGmail smtp SASL 身份验证
【发布时间】:2018-06-23 12:48:50
【问题描述】:

我正在使用 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

这是我的后缀配置:

ma​​in.cf

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
.

有什么想法吗?谢谢!

【问题讨论】:

  • 我在使用 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=deferred (SASL 身份验证失败;服务器 smtp.gmail.com[64.233.186.109] 说:535-5.7.8 用户名和密码不被接受。了解更多at?535 5.7.8 support.google.com/mail/?p=BadCredentialst7sm9274499qte.74 - gsmtp) 知道如何解决这个问题吗?
  • 您有没有机会找到解决方案?我遇到了同样的错误,我正在使用我的应用程序专用密码,并且我在我的主帐户上启用了 2FA。

标签: email smtp gmail postfix two-step-verification


【解决方案1】:

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

【讨论】:

  • 如果您使用 2FA 会怎样?
  • @qdeninja 在这种情况下,您需要创建一个可以与 postfix 一起使用的应用程序密码。
【解决方案2】:

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

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

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

【讨论】:

    猜你喜欢
    • 2017-06-22
    • 2015-07-23
    • 2014-10-31
    • 1970-01-01
    • 2019-03-14
    • 1970-01-01
    • 2017-09-14
    • 2010-10-27
    • 2013-02-06
    相关资源
    最近更新 更多