Ever wondered how to delete a specific email in a postfix queue

Ever wondered how to delete a specific email in a postfix queue

I was looking for an easy way to delete a specific email in a postfix queue on a redhat/centos environment.
Well this is what I found and it worked like a charm 🙂

mailq | tail -n +2 | awk ‘BEGIN { RS = “” } / root@linix\.eu$/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –

This will delete all email coming from root@linix.eu or send to root@linix.eu and will leave the rest of the mails in the queue.

check again with

postqueue -p or mailq

Leave a Reply

Your email address will not be published. Required fields are marked *

ten − six =

This site uses Akismet to reduce spam. Learn how your comment data is processed.