Contents

Crushing postfix

Contents

I have my home-lab set up to send all mail to my Google mail account. All of the hosts in my house are set to send mail to one host, which uses Gmail to relay out. Except, of course, for my Nagios host, which relays directly, but I digress…

This is normally quite excellent.  It’s not, when I accidentally something. If you send too much mail from your Gmail account, Google gives you a “time out”.  Usually, for 24 hours, you can’t send mail.

When I find I’m spamming the hell out of myself, I’ll generally panic and shutdown postfix on the central relay.

1
service postfix stop  

Issue a delete all messages command

1
postsuper -d ALL  

And do the same on all the hosts in the lab spamming.

Yesterday, I wanted to delete the mail from the previous day but keep today’s.

1
postqueue -p | grep "Aug 3"|cut -d" " -f 1 |postsuper -d -  

This did the trick. Of course, awk would work on systems without cut.

1
postqueue -p | grep "Aug 3"|awk '{print $1}' |postsuper -d -