7

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 [email protected], 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 = 192.168.200.0/24, 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     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=<[email protected]>, 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[173.194.66.26]: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[173.194.70.26]: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=<[email protected]>, 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 (173.194.66.26) 56(84) bytes of data.
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=1 ttl=128 time=29.2 ms
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=2 ttl=128 time=29.6 ms
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=3 ttl=128 time=31.0 ms
7
  • What does your mail log say?
    – jordanm
    Jan 22, 2014 at 11:43
  • Edited the question.
    – ludiegu
    Jan 22, 2014 at 11:50
  • Your ISP is probably blocking port 25.
    – jordanm
    Jan 22, 2014 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 Jan 22, 2014 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, 2014 at 12:00

2 Answers 2

8

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.

Use:

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

you should see:

Trying 173.194.69.27...
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).

2
  • 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. Jan 17, 2017 at 21:16
  • Thanks man this helped a lot. I used a VPN service to bypass the block from my ISP.
    – jchook
    Jan 23, 2017 at 0:45
2

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

inet_protocols = all

to:

inet_protocols = ipv4

Then

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .