Delete Specific Messages in Postfix Queue

By November 28, 2012Sample Work

With this simple command you can delete specific messages that are in your Postfix queue.  In this case of a spam attack this is an invaluable command, as you can cleanup the queue of the offending messages.

Enter any text string and this command will hunt the messages and delete them.

First, check what is in the queue with:


Then run the command, making sure to change REPLACEME to the string you search and delete messages for.

mailq | tail -n +2 | awk 'BEGIN { RS = "" } / REPLACEME/ { print $1 }' | tr -d '*!' | postsuper -d -

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments