How To Delete Mails From Or To A Specific Email Address From Your PostFix Mail Queue

You can check your current mail queue like this:

/usr/local/postfix/sbin/postqueue -p
To delete all mails from the mail queue that come from buqg@mail.example.com or are sent to buqg@mail.example.com (the command is the same regardless of if it’s the sender or recipient address), you can use this command:
mailq | tail +2 | awk 'BEGIN { RS = "" } / buqg@mail.example.com$/ { print $1 }' | tr -d '*!' | xargs -n 1 /usr/local/postfix/sbin/postsuper -d
Afterwards check your mail queue again:
/usr/local/postfix/sbin/postqueue -p
It should now be much shorter.

Share