Mail Queue monitoring is a big task for any organization running a busy mail server. Failure to do in a timely manner may lead a huge mail queue of SPAM mails or Bulk mail in the queue, which slows down the delivery of genuine mails in the queue. There are few third party tools and inbuilt command is available to monitor the mail queue in Qmail or Postfix mail server.
Qmail Server Mail Queue monitoring overview:
/var/qmail/bin/qmail-qstat will show current processed or unprocessed mail in the queue. This is a qmail inbuilt command.
/var/qmail/bin/qmail-qread will show a brief details of queued mails, like delivery address and mail type (remote/local).
These are only inbuilt command in Qmail for mail queue monitoring.
There are few third-party tools available for Qmail for mail queue monitoring.
qmHandle is a simple program which allows you to view and manage the Qmail message queue. The software will work on every Unix platform with Perl installed and Qmail installed.
qmHandle Installation:
# wget http://optusnet.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.3.2.tar.gz
# tar -xvzf qmhandle-1.3.2.tar.gz
# cp qmHandle /usr/bin/
Now run the command as
# qmHandle
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
You can view/delete multiple message i.e. -d123 -v456 -d567
The Qmail-Remove utility will remove messages containing a particular string from your Qmail queue.
Qmail-Remove Installation:
# wget http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-0.95.tar.gz
# tar –zxvf qmail-remove-0.95.tar.gz
# mkdir /var/qmail/queue/yanked
# make ; make install
Now for deleting mail containing a particular IP Address run:
# qmail-remove -p 111.111.111.11 –v -d
You can change the IP address with a word string also e.g.
# qmail-remove -p your- string -v -d
# qmail-remove -p your- string -v -r
This will yanked the mails instead of permanent delete.
Postfix Server Mail Queue monitoring overview:
List/Print current mail queue
# postqueue –p
# mailq
Flush the queue
# postqueue -f
Schedule immediate delivery of all mail that is queued for the named as domain.come.
# postqueue -s domain.com
TO delete all queue
# postsuper -d ALL
To delete a particular message
# postsuper -d messageid
Postfix inbuilt tools are pretty good for monitoring the mail Queue.
That’s all, for all my System Admin friends. I will keep posted for other useful article soon. Keep browsing
.




