August 01, 2018

Delete Postfix queued emails From/To specific user


mailq | tail -n +2 | awk 'BEGIN { RS = "" } / user@domain\.com$/ { print $1 }' | tr -d '*!' | postsuper -d -

Or, if using sudo, just add sudo to the part immediately preceding "postsuper":


mailq | tail -n +2 | awk 'BEGIN { RS = "" } / user@domain\.com$/ { print $1 }' | tr -d '*!' | sudo postsuper -d -


Note: This command line was run on a CentOS 6.10 box with Postfix version 2.6.6
Share: