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:
[root@web01 ~]# postsuper -d ALL
How to remove all email in the deferred queue
[root@web01 ~]# postsuper -d ALL deferred
Remove all email in the queue for a specific domain:
[root@web01 ~]# 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:
[root@web01 ~]# postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /user@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -