This is the shortest cheat sheet for those who just started working with Postfix and needs to do something with the mail queue.
Postfix maintains two queues, the pending mail queue and the deferred mail queue. The deferred mail queue has the mail that has soft-fail and should be retried (temporary failure). Postfix retries the deferred queue on set intervals (default = 5 minutes).
Below are the most used commands to manipulate the queue:
mailq
or
postqueue -p
postcat -vq <ID>
<id> ::= XXXXXXXX, e.g. 2B2D742031
postqueue -f
postsuper -d ALL
postsuper -d all deferred
mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($8 == "[email protected]" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -