Delete mail from specific sender from Postfix queue
To delete all email in the Postfix queue from a specific email address run this command as root:
postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /user@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -
Do not forget to escape dots by replacing "." with "\."
If you got an error "postsuper: fatal: use of this command is reserved for the superuser" you are not a root. Just add a sudo
before postsuper
like this:
postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /user@example\.com/ { print $1 }' | tr -d '*!' | sudo postsuper -d -