qmHandle

April 13, 2025 by Roberto Puzzanghera 4 comments

qmHandle is a simple program which allows you to view and manage the qmail message queue.

Changelog

  • Apr 13, 2025
    - the project is abandoned, so I copied the sources to my github, applied the patches and released as 1.3.3
  • Feb 17, 2024
    - patch to fix a typo in parameter usage when help printed
    - merged the previous one with the patch already applied, which replaces svc with qmailctl in start/stop qmail commands

Installation

If you followed the 'quick configuration' based on the config-all script, qmHandle has been installed for you. If it wasn't like that, download and install the binary:

wget https://github.com/sagredo-dev/qmHandle/archive/refs/tags/v1.3.3.tar.gz
tar xzf v1.3.3.tar.gz
cd qmHandle-1.3.3
chown -R root:root .
cp qmHandle /var/qmail/bin

if you have a Debian GNU/Linux with its qmail package edit qmHandle and comment out

#my ($stopqmail) = '/etc/init.d/qmail stop';

Usage

# qmHandle --help

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

Comments

Delete message from sender

Hello, 

could I ask for some examples of how to use -f and -F? It never finds and deletes my email by sender.

Thank you

Reply |

Delete message from sender

Hi, I've just used it successfully as per manual:

qmHandle -fuser@domain.tld

Reply |

Delete message from sender

I've tried it at least 10 times and it never worked for me. So I tried it now again and it works... 

Can I ask for an example where the Regex option -F is used?

Thank you

Reply |

Delete message from sender

qmHandle -l
31220434 (21, 21/31255779)
 Return-path:  
 From: abc123def@domain.tld
 To: user@domain.tld
 Subject: failure notice
 Date: 7 Jul 2025 10:27:46 +0200
 Size: 7340 bytes
[...]

qmHandle -F'.*123.*'
Calling system script to terminate qmail...
Looking for messages from senders matching .*123.*
Message 31235418 slotted for deletion
Message 31255690 slotted for deletion
Message 31235422 slotted for deletion
Message 31234226 slotted for deletion
Message 31255772 slotted for deletion
Message 31220434 slotted for deletion
Message 31201550 slotted for deletion
Message 31247289 slotted for deletion
Message 31200389 slotted for deletion
Message 31235291 slotted for deletion
Message 31247573 slotted for deletion
Message 31235530 slotted for deletion
Message 31247568 slotted for deletion
Deleted 13 messages from queue
Restarting qmail... done (hopefully).

Reply |

Recent comments
Recent posts

RSS feeds