Manage the Qmail mail queueMattias Geniar, Wednesday, June 4, 2008 - last modified: Sunday, November 16, 2014
Ever used qmail? Ever had a mail stuck in the queue that just wouldn't send?
Then you might want to give qmHandle a try. It's a small tool you'll need to download (~16KB), and it'll save you quite some time.
qmHandle -l" lists the current queue. Nothing special about that, running "
/var/qmail/bin/qmail-qstat" will do the same. Then how do you send the mails stuck in the queue? The logs won't tell you the reason why they're still in there. Running "
qmHandle -a" will force the mails in queue to be sent. If for some reason this still fails, the mails will remain in queue.
Now try deleting a mail (or a series of mails) from the queue, based on -- let's say -- the subject. Now it gets harder if you want to use qmail's built-in tools.
qmHandle simplifies this. Running the command "
qmHandle -S'Viagra Penis Enlargments' " will delete all messages from the queue, where the subject contains the string contained in single quotes (note: the single quotes have to be entered directly after -S, there can be no space in between).
qmHandle has a lot more functionality, which you can discover by typing "
qmHandle". It'll give you an output as follows:
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 version Additional (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
Just explore qmHandle a bit, you'll find it quite nice and invaluable when working with a qmail-enabled system.