Tag Archives: Mail

Empty Postfix Mail Queue

Had an issue today where a bug sent over 20,000 messages into my postfix mail queue. Google then started “rate” limiting me as this issue was basically a DOS attack on my mail box. After some research, I found a couple ways to empty the postfix mail queue.

If you only want to purge the queue of email from use user, as root try:

mailq | tail +2 | grep -v ‘^ *(‘ | awk ‘BEGIN { RS = “” } { if ($8 == “user@example.com” && $9 == “”) print $1 } ‘ | tr -d ‘*!’ | postsuper -d –
To purge the entire queue:

postsuper -d ALL