Stolen from http://www.linuxmagic.com/opensource/qmail/qmail-remove/

Qmail-Remove will remove messages containing a particular string from your Qmail queue.

Why?:

This is a useful thing to do in a number of situations. For instance, if you are hit with a spamming attack, you can temporarily instate a second Qmail installation (once the spam run is finished), allow it to take over mail receipt, and then use this tool to clean the offending mails out of the queue before switching over to the main Qmail installation once again.

Occasionally, viruses will get past scanners before the signatures get updated; if they exist in large numbers, it is often practical to stop the Qmail install briefly in order to clean out all messages containing a signature related to the virus.

Whatever the reason to pull items from your mail queue, this program will delete them in such a manner that will let you restore them easily.

"Removed" Emails:

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.

See Qmail-Remove -h for more commandline options.

WARNING: YOU MUST STOP QMAIL BEFORE USING THIS PROGRAM.

http://freebsdrocks.net/files/tarballs/qmail-remove-0.95.tar.gz