Webmaster Forum
HOME WEB DESIGN DIRECTORY WEBMASTER FORUM WEBMASTER ARTICLES ADVERTISE YOUR COMPANY    Advanced search


Clear email queues using qmHandle

Discuss about all shared hosting, dedicated hosting, and managed hosting

Clear email queues using qmHandle

Postby Administrator on 09 Jan 2009, 00:00

When the mail queue on a VPS Server has messages stacked up you can use the tool qmHandle.

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 the file directly from SourceForge using the wget command:

Code: Select all
wget http://optusnet.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.3.2.tar.gz


Then decompress the file using the tar command:

Code: Select all
tar -xvzf qmhandle-1.3.2.tar.gz


First it is recommended to shutdown qmail using the service command to prevent possible corruption of the mail queue:


Code: Select all
service qmail stop 


When you are done with qmhandle be sure to start it again using the service command:

Code: Select all
service qmail start


qmHandle can show it's own options when run without a flag:

Code: Select all
./qmHandle

qmHandle v1.3.2
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 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


-s to see some basic statistics

Code: Select all
qmHandle -s


Code: Select all
Messages in local queue: 0

Messages in remote queue: 10*


-l to see stats about each message in the queue. Can get very long so use -N to see just the message numbers

Code: Select all
qmHandle -l

10601551 (0, R)

Return-path:
From: MAILER-DAEMON@domain.com
To: someone@my-domain.com
Subject: failure notice
Date: 30 Mar 2006 18:12:36 -0800
Size: 1706 bytes
...


* -m to see a particular message. Get the message number from above

Code: Select all
qmHandle -m10600494



Code: Select all
--------------
MESSAGE NUMBER 10600494
--------------

Received: (qmail 15035 invoked for bounce); 5 Apr 2006 08:21:30 -0700
Date: 5 Apr 2006 08:21:30 -0700
From: MAILER-DAEMON@domain.com
To: someone@my-domain.net
Subject: failure notice
Hi. This is the qmail-send program
...



* -D to delete all messages in both the incoming and outgoing queues.

Code: Select all
qmHandle -D

Calling system script to terminate qmail...

Deleting message: 0/10601551 [ OK ]
Deleting message: 1/10600494
Deleting message: 15/10601566
Deleting message: 16/10601567
Deleting message: 18/10601569
Deleting message: 20/10601571
Deleting message: 22/10601550
Deleting message: 6/10601557
Deleting message: 8/10601582
Deleting message: 9/10601583
Restarting qmail... Starting qmail: [ OK ]
done (hopefully).


i found this code and posted here to remember myself. hope will be usefull to you too.
Webmaster
-------------------------
Webmaster Forum
Administrator
Site Admin
 
Posts: 27
Joined: 11 May 2005, 05:42

Return to Website Hosting Forum

Who is online

Users browsing this forum: No registered users and 0 guests


cron