Troubleshooting your mail server

General troubleshooting tips

  • Run “postfix check” to make Postfix look for obvious configuration errors. If it returns no output then no problem was found.
  • Read your /var/log/mail.log and look for warnings and errors.

Postfix keeps unwanted emails in the queue

Check that you do not keep soft_bounce enabled. If “postconf soft_bounce” shows “yes” then run “postconf soft_bounce=no”. To remove all emails from your queue (dangerous!) run “postsuper -d ALL”.

I get “Permission denied” from Dovecot in the mail.log file

You have the permissions wrong. Run:

chown -R vmail:vmail /var/vmail

Postfix says: “Mail loops back to myself”

Postfix tried to send an email to the internet because it did not feel responsible for the recipient’s domain. However DNS records pointed it back to itself. So either your DNS record for a certain domain is wrong (unlikely) or your Postfix refuses to receive email for the given domain (very likely). Check that the recipient’s domain is listed in the “virtual_domains” table in the MySQL database. And verify that your CF files are working correctly

6 thoughts on “Troubleshooting your mail server”

  1. Not sure if this is covered in somewhere and I missed it. But I followed the guide to upgrade from an embarrassingly old server (Lenny) and was taken aback when my X-Original-To header was missing! I ended up rolling back to pipe style delivery in dovecot.

    In any case thanks for this wonderful guide and keeping it updated over the years! Made going back through setup a much easier.

  2. Hello Mr. Haas,
    And first of all, many thanks for the detailed explanations, which not only allowed me to build a (mostly) functioning mail server but to understand more about its inner workings.
    Every test along the tutorial works fine, and I can connect, send and receive via roundcube.
    However, if I try to add my account to Thunderbird, K9 or even Outlook, I can’t get any to work, whatever parameters I might try.
    Strangely, I don’t even appear to get any entries regarding the supposedly failed attempts at connection in the entirety of /var/log (grep -r user@domain . shows nothing). Ports are open and Dovecot is listening on them…
    tcp6 0 0 :::443 :::* LISTEN 596/apache2
    tcp6 0 0 :::4190 :::* LISTEN 566/dovecot
    tcp6 0 0 :::993 :::* LISTEN 566/dovecot
    tcp6 0 0 :::995 :::* LISTEN 566/dovecot
    tcp6 0 0 :::11332 :::* LISTEN 510/rspamd: main pr
    tcp6 0 0 :::11333 :::* LISTEN 510/rspamd: main pr
    tcp6 0 0 :::110 :::* LISTEN 566/dovecot
    tcp6 0 0 :::143 :::* LISTEN 566/dovecot

    I’ve even tried using the IP address as the mail server instead of the FQDN in case there was some resolving problem, but to no avail.
    I’m admittedly stuck, if anyone had ideas, I would be thankful.

    1. Regarding the above, I was fixated on dovecot due to previous problems, but it’s postfix who shall I think receive the connecting request, and here is what I got in the mail.log after another unsuccessful attempt :
      Apr 16 15:12:54 ip-172-31-5-3 postfix/smtpd[1071]: disconnect from unknown[redacted] ehlo=1 auth=0/1 quit=1 commands=2/3
      The auth data is the same as the one used successfully with roundcube.

  3. For a while now it seems I can only send mail with either Roundcube or Thunderbird. Any other client (be it mutt, sylpheed, evolution, claws, …) fails to establish a connection to the webmail domain, with no indication as to why in the server logs. Do you have a clue how I might debug this?

  4. @Christoph

    Moin Christoph,
    erst einmal herzlichen Dank für deine Tutorials. Ich setze diese schon seit Jahren ein und bin froh, dass du diese veröffentlichst.

    Kannst du mir sagen, warum du in diesem Tutorial kein Greylisting nutzt und keine Blacklist abfragen durchführst?

    Danke und beste Grüße aus dem Norden

    1. Christoph Haas

      Moin Martin…

      Greylisting mache ich eigentlich schon. Also genauer gesagt der “rspamd”. Siehe – du kannst die Scores entsprechend ändern, damit das Greylisting immer stattfindet und nicht nur in Zweifelsfällen.

      Auch Blacklisten (RBLs) werden von rspamd beachtet. Das sollte schon funktionieren. Guck mal in die Header deiner empfangenen Emails. Beispiel aus einer Spam-Mail von heute:

      RECEIVED_SPAMHAUS_XBL(3.00)[ :];

      Grüße zurück aus Stormarn…

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top