Troubleshooting mails with Postfix
Introduction
Postfix is great and handles high loads well, but when you need to debug mail problems, it can become less straightforward. Therefore, I’ll document here all the tips and tricks I’ve found.
Solutions
Verify the configuration
In Postfix, it’s not always obvious to find the problem, which is why they’ve been kind enough to include a command that will run checks:
|
|
Mail queue congestion
If you find yourself with a mail queue congestion problem (e.g., 30,000 emails in the queue), you can find out how many there are with the following command:
|
|
But if you have to delete them one by one, it’s a bit tedious. That’s why I created a small script to delete the entire queue:
|
|
This script allows you to select a user and delete all emails where they are involved.
pflogsumm
pflogsumm provides information about emails, including statistics like who receives a lot of emails, who sends a lot, etc. To get logs for the day:
|
|
Get statistics from yesterday:
|
|
On the current log file:
|
|
Note:
|
|
will not give statistics just for yesterday.
qshape
For bottleneck analysis, you can use the qshape command:
|
|
For more info:
http://postfix.traduc.org/index.php/QSHAPE_README.html
fatal: open database /etc/aliases.db: No such file or directory
You simply need to regenerate the alias database. The “newaliases” command will be enough. But on Solaris, and apparently older versions of Postfix, you’ll need to stop and start the service as well:
|
|
exec failed. errno=2.
On Solaris, when trying to send a message with the mail command and it doesn’t work, giving this error:
exec failed. errno=2.
Just create a symbolic link:
|
|
Last updated 05 Feb 2010, 11:09 +0200.