qmhandle.pl – manage qmail queues

This tool has been a life-saver on our hosting servers many times. If your mail queues fill up with spam – perhaps incoming, or perhaps after your server has been hacked (timthumb – that caught a lot of people), then spam can be deleted from the outgoing queue.

For example, to remove all mail from the outgoing queue with the word “c@sino” in the subject, use this command:

   qmhandle.pl -S'c@sino'

Perhaps delete all mail that is stuck in the queue from user “mym3ds@spammer.com”:

   qmhandle.pl -f'mym3ds@spammer.com'

Remember that last one is a regular expression, so escape any special characters.

Showing the state of the queues:

   qmhandle -s

Then listing what is in those queues:

   qmhandle -l | more

The qmhandle.pl script can be found here, but may well be already installed on your server, especially if you use Plesk to manage your server:

http://sourceforge.net/projects/qmhandle/

One Response to qmhandle.pl – manage qmail queues

  1. loic 2014-04-17 at 11:52 #

    hi thanks, i have a probleme when a delete a message by number

    qmHandle -dN125966

    Calling system script to terminate qmail…
    svc: warning: unable to chdir to /service/qmail-deliver: file does not exist

    what can i do, thanks

Leave a Reply