Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had Postfix installed on CentOS earlier (several months ago) and it was working fine. Due to the fact of the many brute-force attempts and considering that I didn't use it almost at all I shut Postfix down. Now I needed to use it, and when I started and tested it: it can receive emails fine, but not send. I tried to send emails to yahoo, google, hotmail, mail.ru, yandex.ru and the result was the same:

postfix/smtp[30799]: 3EA0C11A82FD: to=<i********@gmail.com>, relay=alt4.gmail-smtp-in.l.google.com[74.125.93.27]:25, delay=0.56, delays=0.02/0.01/0.53/0, dsn=4.4.2, status=deferred (lost connection with alt4.gmail-smtp-in.l.google.com[74.125.93.27] while receiving the initial server greeting)

Also there are lines like this:

postfix/smtp[31728]: C792711A82EB: conversation with gmail-smtp-in.l.google.com[74.125.39.27] timed out while performing the EHLO handshake

The only place where I could send emails is mail.md

I re-installed Postfix but nothing changed. Tried to disable firewall without any luck. My IP is not listed/blocked. The configuration is almost default, just the changes described at http://wiki.centos.org/HowTos/postfix which worked earlier.

Checked the SMTP server at mxtoolbox.com. The result is:

220 host-static-x-x-x-x.moldtelecom.md ESMTP Postfix
 OK - x-x-x-x resolves to host-static-x-x-x-x.moldtelecom.md
 OK - Reverse DNS matches SMTP Banner
 0 seconds - Good on Connection time
 Not an open relay.
 1.139 seconds - Good on Transaction time


Session Transcript:
HELO please-read-policy.mxtoolbox.com
250 host-static-x-x-x-x.moldtelecom.md [172 ms]
MAIL FROM: <supertool@mxtoolbox.com>
250 2.1.0 Ok [172 ms]
RCPT TO: <test@example.com>
554 5.7.1 <test@example.com>: Relay access denied [172 ms]
QUIT
221 2.0.0 Bye [172 ms]

There is one strange thing (or maybe not?). When I telnet to my smtp server and try the HELO command I gen an error first time. But it responds ok the second time:

220 host-static-x-x-x-x.moldtelecom.md ESMTP Postfix
HELO somedomain.com
502 5.5.2 Error: command not recognized
HELO somedomain.com
250 host-static-x-x-x-x.moldtelecom.md

Does anybody have any idea what could be wrong?

UPDATE

I have increased the debug level. Here are some logs:

postfix/master[3433]: daemon started -- version 2.3.3, configuration /etc/postfix
postfix/qmgr[3436]: AF95C11A82ED: from=<a****n@i***d.com>, size=597, nrcpt=1 (queue active)
postfix/qmgr[3436]: 89DE011A82EB: from=<a****n@i***d.com>, size=597, nrcpt=1 (queue active)
postfix/smtp[3439]: vstream_buf_get_ready: fd 11 got 45
postfix/smtp[3439]: < gmail-smtp-in.l.google.com[74.125.39.27]: 220 mx.google.com ESMTP a13si2222396fak.134
postfix/smtp[3439]: > gmail-smtp-in.l.google.com[74.125.39.27]: EHLO host-static-x-x-x-x.moldtelecom.md
postfix/smtp[3439]: vstream_fflush_some: fd 11 flush 49
postfix/smtp[3438]: smtp_get: EOF
postfix/smtp[3438]: AF95C11A82ED: lost connection with d.mx.mail.yahoo.com[209.191.88.254] while receiving the initial server greeting
postfix/smtp[3438]: smtp_get: EOF
postfix/smtp[3438]: AF95C11A82ED: lost connection with e.mx.mail.yahoo.com[67.195.168.230] while receiving the initial server greeting
postfix/smtp[3438]: smtp_get: EOF
postfix/smtp[3438]: AF95C11A82ED: lost connection with b.mx.mail.yahoo.com[74.6.136.65] while receiving the initial server greeting
postfix/smtp[3438]: smtp_get: EOF
postfix/smtp[3438]: AF95C11A82ED: lost connection with g.mx.mail.yahoo.com[98.137.54.238] while receiving the initial server greeting
postfix/smtp[3438]: smtp_get: EOF
postfix/smtp[3438]: connect to subsystem private/defer
postfix/smtp[3438]: send attr nrequest = 0
postfix/smtp[3438]: send attr flags = 0
postfix/smtp[3438]: send attr queue_id = AF95C11A82ED
postfix/smtp[3438]: send attr original_recipient = ib****ri@yahoo.com
postfix/smtp[3438]: send attr recipient = ib****ri@yahoo.com
postfix/smtp[3438]: send attr offset = 448
postfix/smtp[3438]: send attr dsn_orig_rcpt = rfc822;ib****ri@yahoo.com
postfix/smtp[3438]: send attr notify_flags = 0
postfix/smtp[3438]: send attr status = 4.4.2
postfix/smtp[3438]: send attr diag_type =
postfix/smtp[3438]: send attr diag_text =
postfix/smtp[3438]: send attr mta_type =
postfix/smtp[3438]: send attr mta_mname =
postfix/smtp[3438]: send attr action = delayed
postfix/smtp[3438]: send attr reason = lost connection with a.mx.mail.yahoo.com[67.195.168.31] while receiving the initial server greeting
postfix/smtp[3438]: private/defer socket: wanted attribute: status
postfix/smtp[3438]: vstream_fflush_some: fd 12 flush 353
postfix/smtp[3438]: vstream_buf_get_ready: fd 12 got 10
postfix/smtp[3438]: input attribute name: status
postfix/smtp[3438]: input attribute value: 0
postfix/smtp[3438]: private/defer socket: wanted attribute: (list terminator)
postfix/smtp[3438]: input attribute name: (end)
postfix/smtp[3438]: AF95C11A82ED: to=<ib****ri@yahoo.com>, relay=a.mx.mail.yahoo.com[67.195.168.31]:25, delay=214, delays=213/0.03/0.77/0, dsn=4.4.2, status=deferred (lost connection with a.mx.mail.yahoo.com[67.195.168.31] while receiving the initial server greeting)
postfix/smtp[3438]: flush_add: site yahoo.com id AF95C11A82ED
postfix/smtp[3438]: match_list_match: yahoo.com: no match
postfix/smtp[3438]: flush_add: site yahoo.com id AF95C11A82ED status 4

UPDATE 2

It seems that that Postfix can send messages to all the servers inside my country, but can not to the servers outside my country. The only difference (found by mailq) between the outside and the inside ones is that the traceroute to outside servers is going through 10.1.74.xx but to inside ones not. I contacted my ISP and they say that they do not block/filter anything, and the only thing they suggested is that I need a PTR record (which can not be the problem).

traceroute:

[root@in-md ~]# traceroute mail.google.com
traceroute to mail.google.com (74.125.39.19), 30 hops max, 40 byte packets
 1  host-static-109-185-171-1.moldtelecom.md (109.185.171.1)  0.334 ms  0.330 ms  0.264 ms
 2  46.74.1.10.in-addr.arpa (10.1.74.46)  0.792 ms  0.795 ms  0.733 ms
 3  host-static-86-106-213-29.moldtelecom.md (86.106.213.29)  1.005 ms  0.875 ms  0.928 ms
 4  host-static-86-106-213-30.moldtelecom.md (86.106.213.30)  0.829 ms  0.807 ms  0.811 ms
 5  host-static-212-0-199-5.moldtelecom.md (212.0.199.5)  3.959 ms  3.935 ms  3.896 ms
 6  host-static-212-0-200-146.moldtelecom.md (212.0.200.146)  2.116 ms  2.133 ms  2.145 ms
 7  core1.ams.net.google.com (195.69.144.247)  46.458 ms  46.559 ms  46.499 ms
 8  209.85.248.88 (209.85.248.88)  47.109 ms 209.85.248.93 (209.85.248.93)  47.279 ms 209.85.248.88 (209.85.248.88)  47.119 ms
 9  209.85.250.141 (209.85.250.141)  54.194 ms 209.85.248.183 (209.85.248.183)  53.980 ms  54.124 ms
10  209.85.254.118 (209.85.254.118)  53.251 ms  53.448 ms  53.849 ms
11  209.85.249.162 (209.85.249.162)  53.631 ms * *
12  fx-in-f19.1e100.net (74.125.39.19)  53.941 ms  54.141 ms  53.749 ms
[root@in-md ~]# traceroute mail.md
traceroute to mail.md (178.17.163.132), 30 hops max, 40 byte packets
 1  host-static-109-185-171-1.moldtelecom.md (109.185.171.1)  0.302 ms  0.319 ms  0.243 ms
 2  host-static-212-0-192-114.moldtelecom.md (212.0.192.114)  0.986 ms  0.983 ms  0.938 ms
 3  host-static-212-0-192-113.moldtelecom.md (212.0.192.113)  1.499 ms  1.366 ms  1.294 ms
 4  in-orange.ch.md.trabia.net (195.22.253.10)  1.113 ms  1.080 ms  1.112 ms
 5  mx3.mail.md (178.17.163.132)  1.115 ms  1.084 ms  1.043 ms

tcptraceroute:

[root@in-md ~]# tcptraceroute mail.google.com
traceroute to mail.google.com (74.125.39.17), 30 hops max, 40 byte packets
 1  host-static-109-185-171-1.moldtelecom.md (109.185.171.1)  0.292 ms  0.267 ms  0.252 ms
 2  46.74.1.10.in-addr.arpa (10.1.74.46)  0.812 ms  0.735 ms  0.727 ms
 3  host-static-86-106-213-29.moldtelecom.md (86.106.213.29)  0.949 ms  0.861 ms  0.906 ms
 4  host-static-86-106-213-30.moldtelecom.md (86.106.213.30)  0.810 ms  0.783 ms  0.828 ms
 5  host-static-212-0-199-9.moldtelecom.md (212.0.199.9)  3.766 ms  3.451 ms  3.306 ms
 6  host-static-212-0-200-146.moldtelecom.md (212.0.200.146)  2.404 ms  2.243 ms  2.057 ms
 7  * * *
 8  209.85.248.93 (209.85.248.93)  47.100 ms  46.942 ms  46.986 ms
 9  209.85.250.141 (209.85.250.141)  54.503 ms 209.85.248.183 (209.85.248.183)  55.067 ms  54.148 ms
10  209.85.254.114 (209.85.254.114)  53.423 ms 209.85.254.116 (209.85.254.116)  54.150 ms 209.85.254.118 (209.85.254.118)  53.800 ms
11  209.85.254.134 (209.85.254.134)  3060.001 ms * 209.85.254.134 (209.85.254.134)  53.877 ms
12  * * *
13  * * *
14  * * *
15  * * *
16  fx-in-f17.1e100.net (74.125.39.17)  54.176 ms  54.156 ms  54.656 ms
[root@in-md ~]# tcptraceroute mail.md
traceroute to mail.md (178.17.163.132), 30 hops max, 40 byte packets
 1  host-static-109-185-171-1.moldtelecom.md (109.185.171.1)  0.371 ms  0.302 ms  0.231 ms
 2  host-static-212-0-192-114.moldtelecom.md (212.0.192.114)  0.998 ms  1.011 ms  0.968 ms
 3  host-static-212-0-192-113.moldtelecom.md (212.0.192.113)  1.456 ms  1.184 ms  0.977 ms
 4  in-orange.ch.md.trabia.net (195.22.253.10)  1.167 ms  1.143 ms  1.391 ms
 5  mx3.mail.md (178.17.163.132)  1.908 ms  2.439 ms  2.252 ms
share|improve this question
    
Huh? You are connecting to Google and get responses from Yahoo? Are these unmodified logs? –  mailq Aug 4 '11 at 13:57
    
No. There was some messages in the queue and when I restarted posfix service it tried to deliver them. In fact connection with Google ends up with the line postfix/smtp[3439]: vstream_fflush_some: fd 11 flush 49 and freezes for a long time. And after that it says that it lost connection during the initial greeting. –  JohnZ Aug 4 '11 at 14:19
    
Sorry. I can't help you from here. Would like to have a chat and a remote connection to check. –  mailq Aug 4 '11 at 14:41
    
Send me your skype/YahooMessenger/Gchat to ibragari at gmail dot com –  JohnZ Aug 4 '11 at 14:55

2 Answers 2

up vote 3 down vote accepted

You don't have a problem with your SMTP daemon but with your SMTP client. It's not a problem when you connect to YOUR server but when you connect to OTHER servers.

So try to telnet 74.125.39.27 25 and look how far you come. As others can connect to Google or whatever it must be something with your network. Do you have a firewall that blocks outgoing SMTP on port 25? Does your provider block port 25?

Postfix tries to connect to other servers and the connection cannot be established. Either in case of your side blocks the connection or on the other hand the destination server refuses the connection. But as I said it is not Postfix related but network related.

Edit: I will not blame anybody. But after a short remote session one could see that someone blocks SMTP traffic to hosts outside of .md. And it is not the firewall! Further diagnosis can't be made even from the server itself.

share|improve this answer
    
I was able to telnet 74.125.39.27 25 and send a message to myself... –  JohnZ Aug 4 '11 at 13:08
    
So is this a sporadic issue or an it-works-never issue? –  mailq Aug 4 '11 at 13:20
    
When I try to send messages by Postfix it is never delivered. It always ends like I described. But I could telnet to google and send a message to my gmail account. –  JohnZ Aug 4 '11 at 13:29
    
I have increased the debug level and added some logs. See the UPDATE. Does it add any clue? –  JohnZ Aug 4 '11 at 13:36
    
I need the line in master.cf which starts with smtp. And the following indented lines (if any). Additionally: Do you have 2 or more IPs configured on that machine? –  mailq Aug 4 '11 at 13:42

It sounds network related (not postfix related), and definitely that someone (or something) is blocking port 25 traffic to all except a 'trusted host'. You would need to A) do a traceroute to mail.google.com, and find out exactly which networks that passes through (maybe not your ISP, but your ISP's ISP?) or B) smarthost all your mail to your ISP's mail server.

Did you try tcptraceroute?

Can you share traceroutes to the 'working' mail server vs the 'non working' mail server?

share|improve this answer
    
I have added the traceroute results to the original post. –  JohnZ Aug 5 '11 at 13:57
    
I have also added tcptraceroute results. –  JohnZ Aug 5 '11 at 14:01
    
What about some other mail servers? Try melix.ams-ix.net and tcmail.telekom.de. Also, what about non-mail servers? www.ripe.net or www.wind.it ? –  Aaron Aug 6 '11 at 3:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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