Mail server trouble shooting
This is a wiki page. Be bold and improve it!
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
Logs
Check the logs!
Telnet
Do not use a common mail client (e.g. Kmail) to troubleshoot the server. Use telnet instead.
Here is a sample POP3 session via telnet:
$telnet example.com 110
Trying 123.145.167.189...
Connected to example.com.
Escape character is '^]'.
+OK Hello there.
user john@example.com
+OK Password required.
pass mypassword
+OK logged in.
quit
+OK Bye-bye.
Connection closed by foreign host.
Here is a sample IMAP session via telnet:
$ telnet example.com 143
Trying 123.145.167.189...
Connected to example.com.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2011 Double Precision, Inc. See COPYING for distribution information.
a login john@example.com mypassword
a OK LOGIN Ok.
logout
logout NO Error in IMAP command received by server.
* NO Error in IMAP command received by server.
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.
Common problems
mail for example.com loops back to myself
You see something like this in the logs:
Dec 3 02:32:06 my_mail_server postfix/smtp[10985]: 65F65F950: to=, relay=none, delay=0.05, delays=0.05/0/0/0, dsn=5.4.6, status=bounced (mail for example.com loops back to myself)
It means that the domain has a DNS MX record (or, failing that, a DNS A record) but your server is not properly configured to accept emails for this domain. It happens when you just set up a new domain but forgot to add the domain in your virtual hosts record. The way to do that depends on your installation. If you use a mysql backend, then you need to add a row in the domains table.
mail postfix/postmap[pid]: fatal: open /etc/postfix/main.cf: Permission denied
Every user who is allowed to send mails (including users' web applications and user scripts), should have read permission to /etc/postfix/main.cf!
So check the read permission for the affecter users/groups. Check the execute and read permission of the parent folders. Also, check for security tools like SE linux who may impose further access permissions to some system files.