Email

允許從任何子域(PTR、SPF、Gmail)發送郵件

  • December 22, 2016

我使用單個智能主機作為集線器來路由來自我的網路的所有電子郵件,以便我可以通過 Gmail 的 SPF 檢查。但是,雖然我總是通過同一台伺服器發送,但From地址可能不同。例如,伺服器上的 cron 作業dev.mydomain.com可能會生成 From address amoe@dev.mydomain.com。我使用/etc/aliases將此 cron 電子郵件重定向到我的真實電子郵件地址。此電子郵件使用託管的 Gmail,因此 MXmydomain.com指向 Gmail 的伺服器。

但是,Gmail 不喜歡這些From地址,可能是因為它們與定義的 SPF 記錄不完全匹配mydomain.com。我收到消息說Our system has detected that this message does not meet IPv6 sending guidelines regarding PTR records and authentication

我不想定義單獨的 SPF 記錄,允許我的一個郵件伺服器為我希望在From地址中允許的每個子域送出電子郵件。相反,我想允許*@*.mydomain.com,只要它是通過正確的伺服器發送的。

2016-12-22 14:04:17 1cK3yj-0007Wz-4I <= amoe@dev.mydomain.com H=(dev.mydomain.com) [2a01:7e00::f03c:91ff:fe79:81b] P=esmtp S=586 id=E1cK3yj-0006Nx-0y@dev.mydomain.com
2016-12-22 14:04:17 1cK3yj-0007Wz-4I ** real@mydomain.com R=dnslookup T=remote_smtp X=TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com": SMTP error from remote mail server after end of data: host ASPMX.L.GOOGLE.com [2a00:1450:400c:c07::1a]: 550-5.7.1 [2a01:7e00::f03c:91ff:febb:7422] Our system has detected that this\n550-5.7.1 message does not meet IPv6 sending guidelines regarding PTR records\n550-5.7.1 and authentication. Please review\n550-5.7.1  https://support.google.com/mail/?p=IPv6AuthError for more information\n550 5.7.1 . p21si28305523wmb.29 - gsmtp

我在 Debian 上使用 Exim。

$$ Edit: It seems the cause was the reverse DNS/PTR record. $$

由於來自 Google 的消息提到了 PTR 記錄,我認為在這種情況下,問題可能不在於 SPF,而是由您的伺服器缺少 PTR 記錄引起的。如果您檢查消息中提到的 URL:https: //support.google.com/mail/?p=IPv6AuthError在“IPv6 的附加指南”下,您應該有您的伺服器的 PTR 記錄(以及匹配的 AAAA 記錄指向回到相同的 IP 地址)。如果2a01:7e00::f03c:91ff:febb:7422是您伺服器的 IPv6 地址,則它沒有 PTR 記錄。

引用自:https://serverfault.com/questions/822261