Qmhandle is a 3rd party application to manage mail queue of Qmail. Though Qmail has it’s own commands but it’s worth using Qmhandle.

1) Download the package in a temporary directory:

# cd /usr/local/src
# wget http://sourceforge.net/projects/qmhandle/files/qmhandle-1.3/qmhandle-\ 1.3.0/qmhandle-1.3.0.tar.gz/download

2) Unpack it and goto the directory

# tar -zxf qmhandle-1.3.0.tar.gz # cd qmhandle-1.3.0

You will notice a “qmHandle” file inside the directory using which you can manage the Qmail mail queue.

1. To check the number of emails in the queue

 # ./qmHandle -s

2. Force Qmail to process the mail queue

 # ./qmHandle -a

3. List emails with all the details like, Subject, From and To address

 # ./qmHandle -l

4. List emails sorted by Subject, From address etc

 # ./qmHandle -l | grep Subject | sort # ./qmHandle -l | grep From | sort 

5. Delete all emails having a specific subject, for example ‘test’

 # ./qmHandle -Stest

6. Delete all messages

 # ./qmHandle -D

Note: The 1.3 version of Qmhandle have problems deleting emails, in such a case download an older version i.e. qmhandle-1.2.3 to delete the emails.