coding, hacking, startups, computer security, technology and more

How to Empty/purge the Qmail Outbound Queue

Qmail has been my MTA of choice now for many years. It's fast, small and very secure.

Sometimes it may be desirable to delete all items from qmali's mail queue. The safest way to clean the outbound queue in qmail is to trick qmail into thinking the messages have been around for too long, so it'll give up and discard the messages. This can be done using find in conjunction with touch:

find /var/qmail/queue/ -type f -depth 3 -exec touch -t 200001010101 {} ;

Once we've touched the messages we then need to signal qmail to re-run the queue :

killall -ALRM qmail-send

Keep an eye on /var/log/maillog to check the progress:

tail -F /var/log/maillog

And that's it!