Qmail queue management with qmhandle
March 31st, 2009 | by Linux Hosting |Introduction
Yesterday a problem arose where a Qmail machine had a queue full of undeliverable emails that we wanted to delete.
Luckily, like most things with sys admin, it’s easy-when-you-know-how and this problem was no exception.
Installation and Configuration
qmhandle is just a perl script and requires a little configuration. It can be downloaded from here http://qmhandle.sourceforge.net
The only configuration that was required was in the “USER CONFIGURATION” section near the top of the script where the use of deamon tools was commented out and instead the use of the rc scripts was enabled by uncommenting the lines:
my ($stopqmail) = ‘/etc/init.d/qmail stop’;
my ($startqmail) = ‘/etc/init.d/qmail start’;
Using qmhandle
Statistics can be gathered similar to that of qmail-qstat for example:-
#qmHandle -s
Total messages: 11
Messages with local recipients: 0
Messages with remote recipients: 11
Messages with bounces: 0
Messages in preprocess: 0
Print a summary of message in the remote queue
#qmHandle -R
355926028 (16, 16/355926028)
Return-path: #@[]
From: MAILER-DAEMON@EXAMPLE.NET
To: postmaster@EXAMPLE.NET
Subject: failure notice
Date: 31 Mar 2009 14:53:58 +0100
Size: 19742 bytes
Total messages: 1
Messages with local recipients: 0
Messages with remote recipients: 1
Messages with bounces: 0
Messages in preprocess: 0
Read a message in the queue
#qmHandle -m355926028
Delete a mesage in the queue (notice how qmail is required to be stopped before anything can be deleted from the queue)
#./qmHandle -d355926028
Calling system script to terminate qmail…
Stopping : Deleting message 355926028…
Deleted 1 messages from queue
Restarting qmail… Starting qmail: [ OK ]
done (hopefully).
Deleting multiple message from the queue can also be achieved. For example to delete all messages with the subject “failure notice” the following command can be used:-
#qmHandle -S”failure notice”
Calling system script to terminate qmail…
Stopping : Looking for messages with Subject: failure notice
Deleting message: 355926066
Deleting message: 355926028
Deleting message: 355926062
Deleting message: 355926060
Deleting message: 355926064
………….
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Tags: qmail, qmhandle, queue management
