Manage the Qmail queue with qmHandle

qmHandle is a tool which can be used to manage the qmail message queue.

  • Check if qmHandle is already installed on the VPS using the Linux command::which
  • which qmHandle
  • If qmHandle is not installed you will receive the message "no qmHandle in..."
  • qmhandle1

Install qmHandle

  1. Grab the installation using the Linux command::wget and extract it with the Linux command::tar
  2. wget http://voxel.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.3.2.tar.gz tar -xvzf qmhandle-1.3.2.tar.gz
  3. Enter the installation directory, move qmHandle to /usr/local/sbin, and then mark it executable with Linux command::chmod
  4. cd qmhandle-1.3.2mv qmHandle /usr/local/sbin/ chmod +x /usr/local/sbin/qmHandle

qmHandle Usage

  • Get a listing of the options for this program using the following command
  • qmHandle
    -a : try to send all 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
    -fsender : delete message from sender
    -f're' : delete message from senders matching regular expression re
    -Stext : delete all messages that have/contain text as Subject
    -h're' : delete all messages with headers matching regular expression re (case insensitive)
    -b're' : delete all messages with body matching regular expression re (case insensitive)
    -H're' : delete all messages with headers matching regular expression re (case sensitive)
    -B're' : delete all messages with body matching regular expression re (case sensitive)
    -t're' : flag messages with recipients in regular expression 're' for earlier retry (note: this lengthens the time message can stay in queue)
    -D : delete all messages in the queue (local & remote)
    -V : print program version
  • Get a summary of the Qmail queue
  • qmHandle -l -c (-c turns on color, which makes things easier to read)

    qmhandle3

  • To see stats about each message in the queue
  • qmHandle -l

    qmhandle4

  • To see a particular message
  • qmHandle -m[message_number]

    qmhandle5

  • To remove all messages matching a certain subject from the queue use the following command
  • qmHandle -S"subject text"
  • Delete all messages in the incoming and outgoing queues
  • qmHandle -D

    qmhandle6

  • To re-process the queue
  • qmHandle -a