Delete emails from mail queue by using qmHandle (Plesk+Linux)

When the mail queue on a dedicated , shared or virtual server has messages stuck in it, qmHandle can be a very handy tool.

First you can check the status of mail queue by using following command:

/var/qmail/bin/qmail-qstat

Download qmHandle from SourceForge. You actually only need the script ‘qmHandle’ so use that if you have it handy. Upload it to the server and untar it if necessary. You may download it from SourceForge using the following command;

wget http://mesh.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.2.0.tar.gz

Untar it by using;

tar -xvzf qmhandle-1.2.0.tar.gz

First it is recommended to shutdown qmail to prevent possible corruption of the mail queue;

service qmail stop

qmHandle can show it’s own options;

./qmHandle
qmHandle v1.2.0
Copyright 1998-2003 Michele Beltrame

*************************

Available parameters:
-a : try to send queued messages now (qmail must be running)
-l : list message queues
-L : list local message queue
-R : list remote message queue
-s : show some statistics
-mN : display message number N
-dN : delete message number N
-Stext : delete all messages that have/contain text as Subject
-D : delete all messages in the queue (local and remote)
-V : print program versionAdditional (optional) parameters:
-c : display colored output
-N : list message numbers only(to be used either with -l, -L or -R)
You can view/delete multiple message i.e. -d123 -v456 -d567

*************************

to see some basic statistics

./qmHandle -s

to delete entire mail queue

./qmHandle -D

to force queue to send all queued messages. For this you will need qmail running.

./qmHandle -a

Make sure once you are done with Qmhandle to start your qmail back up by using;

server qmail start


Enjoy:)





    0 comments: