Postfix – Flush mail queue

I have seen servers where the Postfix mail queue is jammed up with mail, perhaps from a programming error on the application, or maybe spam if they were web hacked. During these times, you may just want to purge the queue since you don’t want the messages going out. Below are some very simple methods of doing this:

How to remove all mail in the postfix queue:

[[email protected] ~]# postsuper -d ALL

How to remove all email in the deferred queue

[[email protected] ~]# postsuper -d ALL deferred

Remove all email in the queue for a specific domain:

[[email protected] ~]# postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -

Remove all email in the queue from a specific email address:

[[email protected] ~]# postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /[email protected]\.com/ { print $1 }' | tr -d '*!' | postsuper -d -