POSTFIX Error: 421 4.7.0 Try again later, closing connection. (EHLO)

6,933

Looking at the official Google documentation looks like a "ratelimit" on their side:

 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.

How many mails per minute are you sending? By experience, usually Gmail accepts 50/100 mail/minute tops.

EDIT as per comment

Well, looks like the same error appears with a wrong HELO/HELO (as I first suspected).

I just tried:

$> 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.

So it's definitively your EHLO string.

You have myhostname = localhost in your main.cf file, you should change it with myhostname = [your server fqdn], i.e. you should have a Fully qualified domain name for your server, complete with correct DNS/rDNS entries.

Share:
6,933
user9111600
Author by

user9111600

Updated on September 18, 2022

Comments

  • user9111600
    user9111600 over 1 year

    I setting main.cf in postfix on Linux SUSE like this

    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
    

    I tried to telnet smtp-relay.gmail.com 25 and it's working

    Anyway, when I tried to send email with postfix in server I got the issue.

    root@localhost
    (host smtp-relay.gmail.com[ipv4] refused to talk to me: 421 4.7.0 Try again later, closing connection. (EHLO)
    
  • user9111600
    user9111600 over 5 years
    I just sent only 1 email per minute or I can say 1 email per hour.
  • Esa Jokinen
    Esa Jokinen over 5 years
    Using temporary error code on a permanent error is not very wise from Google.
  • user9111600
    user9111600 over 5 years
    @Mr Shunz, I still don't have FQDN just now maybe the process will finish on the next week, so can I use ip adress instead?
  • Daniele Santi
    Daniele Santi over 5 years
    @user9111600 I just tried and it seems the error does not appear when using helo IP.ADD.RE.SS. Give it a try!
  • user9111600
    user9111600 over 5 years
    @ Mr Shunz, I just try with your suggestion but it still showing.. root@localhost (delivery temporarily suspended: host smtp-relay.gmail.com[74.125.24.28] refused to talk to me: 421 4.7.0 Try again later, closing connection. (EHLO)
  • user9111600
    user9111600 over 5 years
    It showing error already: postfix: warning: valid_hostname: numeric hostname: 110.49.142.77 maybe I cannot use ip to being hostname.
  • Daniele Santi
    Daniele Santi over 5 years
    @user9111600 you should definitively get a FQDN then.