Linux

POSTFIX 錯誤:421 4.7.0 稍後再試,關閉連接。(EHLO)

  • September 5, 2018

main.cf像這樣在 Linux SUSE 上設置後綴

inet_interfaces = localhost
inet_protocols = ipv4

masquerade_domains =
masquerade_exceptions = root
mydestination = $myhostname, localhost.$mydomain
myhostname = localhost
mynetworks_style = subnet
relayhost=[smtp-relay.gmail.com]:25

smtpd_delay_reject = yes
smtpd_helo_required = no

smtpd_client_restrictions =

smtpd_helo_restrictions =

smtp_sasl_auth_enable = no
smtp_sasl_security_options =
smtp_sasl_password_maps =
smtpd_sasl_auth_enable = no

smtp_use_tls = no

我試過了telnet smtp-relay.gmail.com 25,它正在工作

無論如何,當我嘗試在伺服器中發送帶有後綴的電子郵件時,我遇到了問題。

root@localhost
(host smtp-relay.gmail.com[ipv4] refused to talk to me: 421 4.7.0 Try again later, closing connection. (EHLO)

查看官方的 Google 文件在他們看來就像是“速率限制”:

421, "4.7.0", Try again later, closing connection. This usually indicates a Denial of Service (DoS) for the SMTP relay at the HELO stage.

您每分鐘發送多少封郵件?根據經驗,通常 Gmail 最多接受 50/100 封郵件/分鐘。

根據評論編輯

好吧,看起來同樣的錯誤出現在錯誤的 HELO/HELO 上(正如我最初懷疑的那樣)。

我剛試過:

$> telnet smtp-relay.gmail.com 25
Trying 108.177.15.28...
Connected to gmail-smtp-relay.l.google.com.
Escape character is '^]'.
220 smtp-relay.gmail.com ESMTP b8-v6sm74445wrr.1 - gsmtp
helo localhost
421 4.7.0 Try again later, closing connection. (EHLO) b8-v6sm74445wrr.1 - gsmtp
Connection closed by foreign host.

所以它絕對是你的 EHLO 字元串。

您的文件中有myhostname = localhostmain.cf您應該使用 更改它myhostname = [your server fqdn],即您的伺服器應該有一個完全限定的域名,並帶有正確的 DNS/rDNS 條目。

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