Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 500k spam messages in my outgoing queue. From experience, I know this will take a long time to remove. All the tools I know of require stopping qmail to remove messages.

Does anyone one know of a tool which will let me selectively delete messages from the queue without stopping mail services?

share|improve this question

Mail queue removal tool for qmail, remove the mail queue by stoping and starting the service. There is no exact tools for removing the mail queue without stoping the qmail service.

But you can control how long a message stays in a queue by editing the file /var/qmail/control/queuelifetime. By default 86400 sec Will keep the mail for 1 day and expire after that.Here you can change this value to 1 and restart your qmail server it should clear your qmail queue.

share|improve this answer
My eventual solution was to stop qmail move the queue away and make a new queue directory then run queue-fix on the empty directory to create valid permissions and folder structure. then I could run some search and kill scripts on the offline queue before copying it back to standard location and queue-fixing it. ths meant legit mail was saved with mai services offline for only a very short time. – ollybee Jan 17 '12 at 20:40

You can use qmHandle which you can find here

You can delete individual msgs or delete the whole queue (even though it deletes both local and remote queues). There are further options to delete msgs depending on RegExps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.