(dv):Clear email queues with qmHandle

  • This page was last modified on May 10, 2012, at 10:39.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

End of Life Warning

This service has a pending End of Life. Please move to a current service as soon as possible. For more information, please see: (dv) Dedicated-Virtual 4.0: Migration Information.

Contents


This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.

Overview

When the mail queue on a (dv) Dedicated-Virtual Server has messages stacked up, you can use the tool qmHandle.

Instructions

  1. 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:
    wget http://sourceforge.net/projects/qmhandle/files/qmhandle-1.3/qmhandle-1.3.2/qmhandle-1.3.2.tar.gz/download
  2. Then decompress the file using the tar command:
    tar -xvzf qmhandle-1.3.2.tar.gz
    
  1. First it is recommended to shutdown qmail using the service command to prevent possible corruption of the mail queue:
    service qmail stop  
  2. When you are done with qmhandle be sure to start it again using the service command:
    service qmail start
    


  • qmHandle can show it's own options when run without a flag:
./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
qmHandle -s
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
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
qmHandle -m10600494




--------------

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.
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).