Postfix - 无法通过终端向 Gmail 地址发送电子邮件

Postfix - 无法通过终端向 Gmail 地址发送电子邮件

当我尝试通过我的终端向 Gmail 地址发送电子邮件时出现以下错误:

sudo tail /var/log/mail.log
Jul 19 13:19:44 ubuntu-4gb-fsn1-1 postfix/cleanup[5780]: B4B8C5F4A3: message-id=<20230719131944.B4B8C5F4A3@ubuntu-4gb-fsn1-1>
Jul 19 13:19:44 ubuntu-4gb-fsn1-1 postfix/qmgr[4961]: B4B8C5F4A3: from=<[email protected]>, size=269, nrcpt=2 (queue active)
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/smtp[5782]: B4B8C5F4A3: to=<[email protected]>, orig_to=<[email protected]>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c00::1a]:25, delay=0.36, delays=0.02/0.02/0.13/0.19, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:400c:c00::1a] said: 550-5.7.1 [2a01:4f8:c012:4b7::1] Our system has detected that this message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and 550-5.7.1 authentication. Please review 550-5.7.1  https://support.google.com/mail/?p=IPv6AuthError for more information 550 5.7.1 . x6-20020adfffc6000000b003141bf7bf82si2173949wrs.938 - gsmtp (in reply to end of DATA command))
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/smtp[5783]: B4B8C5F4A3: to=<[email protected]>, orig_to=<[email protected]>, relay=mx-eu.mail.am0.yahoodns.net[188.125.72.74]:25, delay=0.58, delays=0.02/0.03/0.26/0.27, dsn=2.0.0, status=sent (250 ok dirdel)
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/cleanup[5780]: 4C4165F4A6: message-id=<20230719131945.4C4165F4A6@ubuntu-4gb-fsn1-1>
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/bounce[5784]: B4B8C5F4A3: sender non-delivery notification: 4C4165F4A6
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/qmgr[4961]: 4C4165F4A6: from=<>, size=3040, nrcpt=1 (queue active)
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/qmgr[4961]: B4B8C5F4A3: removed
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/smtp[5782]: 4C4165F4A6: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[64.233.184.26]:25, delay=0.52, delays=0/0/0.11/0.41, dsn=5.7.26, status=bounced (host gmail-smtp-in.l.google.com[64.233.184.26] said: 550-5.7.26 This mail is unauthenticated, which poses a security risk to the 550-5.7.26 sender and Gmail users, and has been blocked. The sender must 550-5.7.26 authenticate with at least one of SPF or DKIM. For this message, 550-5.7.26 DKIM checks did not pass and SPF check for [] did not pass with ip: 550-5.7.26 [128.140.116.155]. The sender should visit 550-5.7.26  https://support.google.com/mail/answer/81126#authentication for 550 5.7.26 instructions on setting up authentication. n18-20020a5d6612000000b003142602c3e3si2110526wru.914 - gsmtp (in reply to end of DATA command))
Jul 19 13:19:45 ubuntu-4gb-fsn1-1 postfix/qmgr[4961]: 4C4165F4A6: removed

我已将 IPv6 上的 PTR 记录设置为:

mail.xxx.net

我还将 SPF 和 DKIM 添加到我的 DNS 记录中。我已经使用 ipv6 和 ipv4 作为邮件服务器建立了我的网站。

我还遗漏了什么或者配置错误了什么?

注意,我已将 Postfix 设置为将收到的电子邮件转发到我的 Yahoo 和 Google 邮箱帐户。这没问题。

仅当我尝试通过我的终端发送电子邮件(gmail 到我的域)时才会发生上述错误:

echo "test email" | sendmail -F "LXX" -f "[email protected]" [email protected]

通过我的终端从我的域发送电子邮件到 Gmail 时没有错误:

echo "test email" | sendmail -F "LXX" -f "[email protected]" [email protected]

为什么?有什么想法吗?

答案1

我很惊讶地得知 Google 仍在使用这个。大概他们只需要 PTR 来匹配 SMTP HELO,而不是 RMX。是吗?

我已将 IPv6 上的 PTR 记录设置为:

我希望您确实将其设置为符合规范的值,而不是您在此处向我们展示的值。互联网上有很多 SPF 测试仪 - 您试过吗?

仅当我尝试通过我的终端发送电子邮件(gmail 到我的域)时才会发生上述错误:

啊。这就是问题所在。如果电子邮件通过您的 MTA 发送,那么 Google 会认为您在发送垃圾邮件。您的域名不是 gmail 的有效来源。您需要将您的 Gmail 帐户配置为使用“安全性较低的应用程序访问”,并将您的 postfix 实例配置为中继全部通过 Gmail 发送电子邮件使用您的 Gmail 登录名和密码。

设置起来更容易一些空邮件程序或者,只需使用您域中的电子邮件地址作为 FROM + 发件人:

相关内容