Guide updated on 29th of December 2011

Install and use qmqtool


Qmqtool - a qmail queue manipulation program geared towards the viewing and safe modification of the contents in a qmail queue

Qmqtool is a utility designed for viewing and safely modifying the contents of a qmail queue. It is extremely feature rich, with features including finding abusers, sorting messages by sender/sender's IP, showing stats, requeueing messages, queue consistency check, queue backup/restore, and others.

Configure it

cd /downloads/
tar zxvfp /downloads/qmqtool-1.14.tgz
cd /downloads/qmqtool-1.14/
./configure --perl=/usr/bin/perl --qmaildir=/var/qmail

You should have such result

found perl: /usr/bin/perl
found qmail directory: /var/qmail
qmqtool will be installed in: /usr/local/script
documentation will be installed in /usr/local/man

if any of these values need changing, try ./configure --help

Making sure this package is intact..
src/qmqtool syntax OK
...done.
Writing Makefile...

now type 'make' and then 'make install'

Compile it

make
make install

You should have such result

mkdir -p /usr/local/script
cp qmqtool /usr/local/script
chown 0 /usr/local/script/qmqtool
chmod 755 /usr/local/script/qmqtool
mkdir -p /usr/local/man/man8/
cp qmqtool.8 /usr/local/man/man8/
chown 0 /usr/local/man/man8/qmqtool.8
chmod 744 /usr/local/man/man8/qmqtool.8

ln -s /usr/local/script/qmqtool /usr/local/bin/qmqtool

Use it

        qmqtool version 1.14
        syntax: qmqtool [-l] [-L] [-R] [-S [-nN]] [-T] [-s] [-Q] [-c] [-r] [-i [-nN]] [-V]
                        [-E(A|R|L)] [-U(A|R|L)] [-vN [-w]] [-e(N|[-f 'STRING'][-oN])] [-u(N|[-f 'STRING'][-oN])]
                        [-d(N|[-f 'STRING'][-oN])] [-f 'STRING'] [-oN] [-B(b|r)] [-x(N|[-f 'STRING'][-oN])]

        -l              list messages in all parts of the queue
        -L              list messages with local recipients
        -R              list messages with remote recipients
        -T              list messages not completely processed
        -s              show statistical information
        -Q              be as quiet as possible (useful for snmp, cron, and such)
        -V              be more verbose
        -B
          b             Backup queue into /var/qmail/queue.backup/
          r             Restore backup from /var/qmail/queue.backup/
        -c              check queue consitancy
        -r              repair queue (by deleting fragments) found by checking queue consistancy
        -i              show how many messages are queued per ip address
           -nN          pay attention to the Nth last smtp-hop
        -S              show how many bytes are queued per ip address
        -e              expire message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -u              unexpire message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -d              delete message
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N
        -E              expire messages in [A]ll, [R]emote, or [L]ocal queues
        -U              unexpire messages in [A]ll, [R]emote, or [L]ocal queues
        -v
          N             view first 100 lines of message number N
          N -w          view whole message N
        -f 'STRING'     display comma separated list of message number(s) containing STRING.
                        prints 0 if no matches are found.
        -o N            display comma separated list of message number(s) older than N hours.
                        prints 0 if no matches are found.
        -x N            prints extended information on message N.  format identical to -l.
                        may specify N (multiples may be comma separated), or -f 'STRING' and/or -o N

List of optional features


Users comments
Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.