How to delete emails from qmail queue on H-Sphere

First check the status of your queue:

# /var/qmail/bin/qmail-qstat
messages in queue: 6751
messages in queue but not yet preprocessed: 56

After you find and stop the spammer, you now have a bunch of email on your QMail queue. Here’s how to remove it

take a “” that happens in emails from the spammer (usually the sender) and run this command:

grep -R /var/qmail/queue/mess/* | awk -F”:” ‘{print “rm -f ” $1}’ | sh

make sure the quotes and single quotes are straight, not round upon copy/paste

That will delete the emails that contain that

but it would leave behind various indexes and later on your users would start receiving bouncebacks for emails they’ve never sent!


this removes not only messages, but all the mentioning of those messages from everywhere. (sasa4uk)

Leave a Reply