Troubleshooting postfix server issues

From Notes_Wiki

Home > CentOS > CentOS 6.x > Postfix server configuration > Troubleshooting postfix server issues

Deleting all emails from defer, deferred, etc. queues

If accidentally someone has created a SMTP relay server which relays all emails, then spammers will try to abuse this server to send emails to a large number of other victims. In such cases postfix queue defer and deferred will grow very large as destination mail server will try to block postfix. This can be checked using:

du -sh /var/spool/postfix/*

and if size of defer and deferred is in GBs then there is some serious problem. Now 'postqueue -p | more' can help in seeing that the problem is really due to spammers. Once it is verified that accidental free RELAY is the problem, the queues can be emptied by deleting all defer and deferred emails using:

postsuper -d ALL defer
postsuper -d ALL deferred

There is also option to delete all queued emails from all queues:

postsuper -d ALL

Please note that some legitimate email, if deferred for some unfortunate reason, is also present in any of these two queues then that would also get deleted. I do not have good way around this apart from going into various postfix spool folders and trying to delete files with find and grep combination while avoiding deleting useful emails.

Message file too big issue

By default postfix limits emails to 10MB and mailboxes to 50MB. Postfix defaults can be seen using:

postconf -d | grep size

To allow unlimited email and mailbox size, we can use following commands:

sudo postconf -e mailbox_size_limit=0
sudo postconf -e message_size_limit=0
service postfix restart

These commands basically append the necessary configuration lines to /etc/postfix/ file. After changing the configuration we can list the parameters which have non-default values using:

postconf -n | grep size

Reading emails stored in maildir format

In maildir format a mailbox folder has some index files as cur, new and temp folders with each email in a separate file. Other subfolders may get stored with names starting with . (hidden). To read emails in maildir format, use mutt as follows:

mutt -f <folder-name≫

Note that using this only one folder (Inbox, Sent, etc.) can be read at a time.

Steps learned from

Reading emails stored in mbox format

In mbox format mails start with a From header. There is a blankline between two emails. If an email has From as first word in a line then a greater than '>' (archive / comment) sign is prepended to such lines automatically to avoid confusion during parsing. To read emails stored in mbox format, use mail as follows:

mail -f <file-name>

Home > CentOS > CentOS 6.x > Postfix server configuration > Troubleshooting postfix server issues