FreeBSD and Postfix

Working with the Postfix Queue

Postfix has a great array of tools to check and manipulate the mail queues.  The postfix queues can get email stuck or backed up in them. This can happen for a number of reasons, anything from network issues, remote mailservers not responding, or just simple miss configuration. When this happens here is a list of a few ways to deal with it.

 

The first thing to do is fix the problem (if possable). Issuing this command will tell postfix to try and deliver the mail from the queue.

 

 postsuper -r ALL
  postfix flush 

However if you discover (using the mailq command) that the deferred mail is useless anyway, it may be desirable to just purge it from the queue without delivering, like so…

 postsuper -d ALL deferred 

Specific messages can be removed based on their message ID, which is the first thing shown for each message shown in the mailq output.

 postsuper -d 0C0ED360F1 

Many MAILER-DAEMON mail messages are moved to the deferred queue, which you can check by:

 qshape -s deferred | head 

To delete these messages use:

 mailq | grep MAILER-DAEMON | awk '{print $1}' | postsuper -d - 

Leave a Comment

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