I have installed Postfix on my CentOS machine. I can nicely send mails to local accounts with mutt, but when I try to send one to a remote mail like myactualmail@gmail.com, I cannot understand why I can't receive anything. Here my main.cf:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = server.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks =,
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

In the maillog I find these:

Jan 22 14:33:15 server postfix/qmgr[5025]: 316FEBF65E: from=<diego@example.com>, size=430, nrcpt=1 (queue active)
Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[]:25: Connection refused
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1a]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[]:25: Connection refused
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: 316FEBF65E: to=<myactualmail@gmail.com>, relay=none, delay=2662, delays=2661/0.04/0.08/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable)

But I can ping nicely the host:

ping gmail-smtp-in.l.google.com
PING gmail-smtp-in.l.google.com ( 56(84) bytes of data.
64 bytes from we-in-f26.1e100.net ( icmp_seq=1 ttl=128 time=29.2 ms
64 bytes from we-in-f26.1e100.net ( icmp_seq=2 ttl=128 time=29.6 ms
64 bytes from we-in-f26.1e100.net ( icmp_seq=3 ttl=128 time=31.0 ms
  • What does your mail log say? – jordanm Jan 22 '14 at 11:43
  • Edited the question. – ludiegu Jan 22 '14 at 11:50
  • Your ISP is probably blocking port 25. – jordanm Jan 22 '14 at 11:52
  • yes, do a telnet gmail-smtp-in.l.google.com 25 to test. You want to see "Connected". I describe it here: linuxintro.org/wiki/Set_up_your_mail_server_for_sending#Test_it – Thorsten Staerk Jan 22 '14 at 11:57
  • can you run nmap to see if the ports are reachable? nmap gmail-smtp-in.l.google.com Are you behind a router/firewall? – chaos Jan 22 '14 at 12:00

The first thing to do in case of SMTP problems where the configuration seems to be OK is that you can actually reach the SMTP server.


telnet gmail-smtp-in.l.google.com 25

you should see:

Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP lv5si9142984bkb.114 - gsmtp

(after that type QUITEnter to exit) If that doesn't show up your firewall (or more likely the one of your provider) might be blocking you. Try this from another location if possible to double check the machine is responding (in your case gmail-smtp-in.l.google.com is responding).

If the provider is the cause, you may need to use its STMP server (they attempt to prevent spam going out from your system this way).

  • I found that from my office network the telnet worked but from my home network didn't (using the above command). When I changed it to telnet smtp.gmail.com 465 it worked from my home network. – Sridhar Sarnobat Jan 17 '17 at 21:16
  • Thanks man this helped a lot. I used a VPN service to bypass the block from my ISP. – jchook Jan 23 '17 at 0:45

Try to change inet_protocol option in postfix settings. Go to /etc/postfix/main.cf and change from:

inet_protocols = all


inet_protocols = ipv4


service postfix reload
service postfix flush
  • This won't fix the problem of the OP. The logs clearly show that the connection is refused on IPv4. – Dubu Sep 23 '15 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.