Postfix can receive but can't send mails

Discussion in 'Server Operation' started by laza, Apr 6, 2014.

  1. laza

    laza New Member

    After VM was used to send large amount of spam (open relay, don't know exactly how much cause maillog was 750Mb), I had to do something urgently. Decidet to backup all websites via virtualmin backup, send them to new virtualmin VM with different IP and on different server. Changed nameservers and all worked like a charm for less than a day.

    But, after that, mail can be received, but can't be send. Maillog looks like
    I still got large number of spam, which is now refused, cause of milter, don't know if it's somehow connected, so better to say: looks same like files on other VMs, which can send email:
    If someone can help, I would really appreciate, cause I'm tired after 2 days of trying to fix this, and I'm running out of time.
  2. hereinoz

    hereinoz New Member HowtoForge Supporter

    You haven't posted any of your outbound mail logs, so that we can see what is happening at your mail server when it attempts to send email, so I am guessing that your server is denying your attempted connection when you try to send email. Is that correct? Or is the server receiving your email for transmission and then not able to send it?
  3. laza

    laza New Member

    I don't know, really. It all worked, for a day and then stopped. Tell me what kind of log you need, so I can copy it. As I see, when I get error in outlook, only log that get new time stamp is maillog.

    Error in outlook looks like some kind of timeout
  4. hereinoz

    hereinoz New Member HowtoForge Supporter

    OK, so the problem appears to be with the connection between your Outlook client and the SMTP server. It is not so much that Postfix can't send emails, rather that your mail program, Outlook, is unable to contact the postfix server to hand it the email to send.

    If the system worked for a while, then stopped, there is possibly a problem in the settings in Outlook, or a firewall has been put in place, or something like that which is stopping your mail program contacting the mail server.

    I know that we have some ISPs in Australia who prohibit port 25 traffic on their network unless it is destined for their own mail server. You need to check this. Clearly the url of the mail server is pingable, as you can receive mail.

    The log you are looking for is usually in /var/log and it is mail.log

    If you can ssh to the server, or open a console, go to /var/log then enter tail -f mail.log

    This will open up the log file and show you all the log entries as they happen. You can then try to send a mail message, and watch the log and see what your mail server is doing (if anything) when the connection from your computer is attempted.

    If there is no activity in the log, then it is a network issue between you and the mail server. If there is activity, hopefully you will be able to see what is going on.
  5. hereinoz

    hereinoz New Member HowtoForge Supporter

    I just did a test on your mail server and it did indeed respond to my SMTP request, BUT, it looks like your Postfix config is not what it could be. It appears that your mail server was quite happy to send email from the test site I used, hence your mail server could be used by anyone as a sending mail server.

    Here is the output of the test:

    SMTP Reverse DNS Mismatch Warning - Reverse DNS does not match SMTP Banner More Info
    SMTP Open Relay May be an open relay. More Info
    SMTP Reverse Banner Check OK - resolves to

    SMTP TLS OK - Supports TLS.
    SMTP Connection Time 2.449 seconds - Good on Connection time
    SMTP Transaction Time 4.961 seconds - Good on Transaction Time
    Session Transcript:
    Connecting to

    220 ESMTP Postfix [2262 ms]
    250-SIZE 10240000
    250 DSN [749 ms]
    MAIL FROM: <[email protected]>
    250 2.1.0 Ok [811 ms]
    RCPT TO: <[email protected]>
    250 2.1.5 Ok [827 ms]

    MXTB-PWS3v2 6474ms

    Unless you have deliberately set up Postfix to accept and then discard attempts like this, to, perhaps, discourage a directory harvest attack, you need to fix the open relay status of your Postfix server as a matter of urgency, otherwise, half the world could be sending email through it, and that is not what you want.

    If this postfix instance is on a hosted server somewhere, then it is highly possible that the hosting organisation has realised that the server is an open relay, and has taken steps to mitigate the problem, by blocking some or all SMTP traffic.

    Good luck.
  6. laza

    laza New Member

    Just checked, and you were right, postfix can send email (via webmail only), but outlook can't connect to it. So guess port is not blocked.

    I guess, by default virtualmin settings, that postfix accept every email, but then reject it if not on permitted users list. Looks that way by the log:

    And there is no mail.log file in /var/log, this is CentOS 6, 64bit, devel.

    But I still can't find where problem is, will try with debugging features in postfix, to log verbose, I might find something useful.
  7. hereinoz

    hereinoz New Member HowtoForge Supporter

    You are right about the open relay. I just tested it and it received an email which I sent it, but then bounced it back. That would appear to be fine. However, the fact that I can get a response indicates that your server is working and you are not even "hitting" your mail server. Something is blocking you between your computer and the server.

    I am not really all that knowledgeable with CentOS, so I am about at the end of my knowledge now. It does seem as though the server is able to send email, but you are not able to connect to it.

    That means that either the server is blocking you, for some reason, or you are not even getting to the server. I have just opened a telnet session with your server and it seems to be working fine. Here is the output:

    telnet 25
    Connected to
    Escape character is '^]'.
    220 ESMTP Postfix
    250-SIZE 10240000
    250 DSN

    As you can see, I am able to access your server fine. If you can't, it would appear to be something between you and the server.

    Try opening a a command window and typing: telnet 25
    and see what you get. If you get a response of:
    220 ESMTP Postfix
    and you should get the responses above. If you don't get a connection, start checking out the network between you and the server. Take your computer, if you can, to a friend's place who is using a different ISP and try Telnet again. If it connects from your friend's place, then it is your ISP related. If it doesn't connect from the friend's place, then suspect your computer. It is a process of elimination from here.
  8. laza

    laza New Member

    Just a bit of update, for ones who have similar problem. From some reason, port 25 don't work as it should so after switching SMTP to 587, all works now. Guess Dovecot was ok after all.

    P.S. ClamAV also had some problems after that, but one restart fixed all.

Share This Page