Install qmqtool for Qmail on Centos Server

From Brian Nelson Ramblings
Revision as of 05:48, 30 November 2013 by Brian (Talk | contribs) (Created page with "==Install qmqtool for Qmail on Centos== Now that you have installed Qmail, you will probably want to install and use qmqtool. This tool helps you manage the mail when using ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Install qmqtool for Qmail on Centos

Now that you have installed Qmail, you will probably want to install and use qmqtool. This tool helps you manage the mail when using 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 more...

cd /downloads/
tar zxvfp /downloads/qmqtool-1.14.tgz
cd /downloads/qmqtool-1.14/
./configure --perl=/usr/bin/perl --qmaildir=/var/qmail
make && make install 
ln -s /usr/local/script/qmqtool /usr/local/bin/qmqtool 

Thats it now your done, Just type qmqtool to see how to use it.

I also have that in a script, so when I install qmail on a new server, I just download the script and run it. If you would like you can download the script and run also, instead of type the above out.

mkdir /scripts
cd /scripts
wget http://www.briansnelson.com/stuff/qmail/install-qmqtool.script
bash install-qmqtool.script

Here are a few examples on how to use qmqtool

Usage samples

List all messages in the queue having the subject "XXX" (case insensitive)

qmqtool -f '/^subject: xxx/i'

Delete all messages in the queue having the subject "XXX" (case insensitive)

qmailctl stop
qmqtool -d -f '/^subject: xxx/i'
qmailctl start

Who are the top senders for the remote queue

qmqtool -R | grep "From: " | sort | uniq -c | sort -rn | head -20

Who are the top recipients of the remote queue

qmqtool -R | grep "To: " | sort | uniq -c | sort -rn | head -20
qmqtool -R | grep "Envelope Recipient: " | sort | uniq -c | sort -rn | head -20

What are the top subjects of the remote queue

qmqtool -R | grep "Subject: " | sort | uniq -c | sort -rn | head -20

What domains are being sent the most mail from the server

qmqtool -R | grep "To: " | cut -d @ -f2 | tr -d '>' | sort | uniq -c | sort -rn | head -20
qmqtool -R | grep "Envelope Recipient: " | cut -d @ -f2 | awk '{print $1}' | tr -d '>' | sort | uniq -c | sort -rn | head -20

Who are the top receivers for the local queue

qmqtool -L | grep "To: " | sort | uniq -c | sort -rn | head -20
qmqtool -L | grep "Envelope Recipient: " | sort | uniq -c | sort -rn | head -20

What domains are have the most mail in the local queue

qmqtool -L | grep "To: " | cut -d @ -f2 | tr -d '>' | sort | uniq -c | sort -rn | head -20
qmqtool -L | grep "Envelope Recipient: " | cut -d @ -f2 | awk '{print $1}'

Who most of my remotely queued messages are destined for ?

qmqtool -R | awk '/Recipient:/ { print $3 }' | sort | uniq -c | sort -n

How can I expire messages with a subject of "Failure Notice" that are have been queued for 18+ hours ?

qmqtool -V -e -o 18 -f '^Subject: Failure Notice' 

Additional articles:

comeing soon...