Postfix Queue Management
Posted by on 09 October 2018 11:58 AM
|
|
To find which mails are stuck in mail queue and why? If emails are getting delayed, its better to inspect postfix mail queues, coupled with postfix mail log. Status/Shape of Mail QueuePostfix maintains different queues for different purpose. Ideally, we should never have a mail in deferred queue.
Sample Outputs:
If a mail is deferred, it will be moved to deferred queue. Running following command will show you the number of deferred emails for each domains…
Sample Output:
If you see mails to one or more domain only being deferred, check if you can connect to those servers from your network. Analyze mails in queue Dump entire mail queueYou can use either
You get dump for all emails from all mail queues including active & deferred queue. Read an email from mail queueEvery message in queue has a unique id. You can read message in queue using a command like:
Or
It will display your emails with headers and some more info. Using ‘v’ will display extra information. Attempt to send an email from mail queueIts better to first open postfix log using something like below:
Then you can identify a stuck mail and attempt to send it by using:
If that mail gets stuck again, check log tab to find reason. Once you fix issue, you can attempt to send that mail again. Mail ID inside queue remains same even if mail gets deferred again and again. Attempt to send all email from mail queueOnce you rectify issue and confident about delivery, you may try flushing entire queue immediately using:
Deleting Pending mails from queueSometimes you realize that all stuck emails are being sent to non-existent emails. Most likely emails generated because of some spam activity. Delete All Deferred MailsIn that case, you can simply delete all queued mails using:
Delete a single mail from queueIf you want to just delete one mail, you can try:
Delete mails to a specific mail addressYou need to some work here as postfix has no direct command for this. Following sample is taken from postsuper man page:
Just replace USER@EXAMPLE.COM with receiver email address.
If you want to filter from-email address, use | |
|