Postfix queue management

Haven’t touched Postfix in a long time since I do very little administration work anymore, but recently found a server that had a ton of mail queued up.

The way I used to manage it was with qvmenu.pl. You could find it here – http://taz.net.au/postfix/scripts/qvmenu.pl – it shows a graphical (curses based) user interface that allows you to select messages, read them, delete them, etc.

What if I wanted to really delete a ton of messages though? I did a quick search and found http://www.howtoforge.com/delete-mails-to-or-from-a-specific-email-address-from-postfix-mail-queue and modified the command to work for me. I decided to run these commands:
mailq | tail +2 | awk ‘BEGIN { RS = “” } / MAILER-DAEMON*/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –
mailq | tail +2 | awk ‘BEGIN { RS = “” } / root@wuhan\.shocknetwork\.com$/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –

This way, I’m getting rid of all of the bounce and double bounce messages and also the ones from root that probably aren’t important.