Qmail-Remove will remove messages containing a particular string from your Qmail queue.
Mails are *not* deleted from the queue! They are only stored, temporarily, in $qmail-queue/yanked/, where you can view them individually and restore them back to the queue manually. There is currently no support for restoring them automatically.
By default, Qmail-Remove assumes that your Qmail queue is stored in /var/qmail/queue, but this can be changed with a command line option. Similarly, Qmail-Remove assumes that your queue “split” is 23 by default, among other things.
If you want to check your qmail queue using the following command
# /var/qmail/bin/qmail-qstat
Output looks like
messages in queue: 567154
messages in queue but not yet preprocessed: 3
Install Qmail-Remove
First you need to download latest version from here current version is Qmail-Remove 0.95
Download using the following command
#wget http://www.linuxmagic.com/opensource…remove-.tar.gz
Now you have qmail-remove-0.95.tar.gz file and now you need to extract using the following command
#tar -zxvf qmail-remove-.tar.gz
Now you should have qmail-remove-0.95 folder go in to the directory and run the following commands
#make
#make install
This will complete the installation.
Now you need to create a directory named “yanked” in the qmail queue directory you intend to use before using this program.
#mkdir /var/qmail/queue/yanked
Examples for qmail-remove
Before doing any thing related to qmail queue you need to stop the qmail service using the following command:
#/etc/init.d/qmail stop
To delete mails from Que,
#qmail-remove -r -p
# qmail-remove -r -p mega.pack.com
This will remove all emails in queue with “mega.pack.com” in it and place it in /var/qmail/queue/yanked folder.
