Good way too remove SPAM from QMail queue (HSphere)

If you ever ran /var/qmail/bin/qmail-qstat

to get something like this


[root@mail2 root]# /var/qmail/bin/qmail-qstat
messages in queue: 4830
messages in queue but not yet preprocessed: 173

After you find and stop the spammer, you now have a mess of email on your QMail queue .. here is a way to remove it

take a “user@domain.com” that is common on the spammed emails (usually the sender) and run this command


grep -R user@domain.com /var/qmail/queue/mess/* | awk -F":" '{print "rm -f " $1}' | sh

That will delete the emails that contain that user@domain .. be very careful with this, a wrong setting and you can be wiping your mailserver clean instead 😉

Null

NullMind

Portuguese born, american accent, living in UK.

2 thoughts on “Good way too remove SPAM from QMail queue (HSphere)

  1. Thanks 🙂

    Although… It does leave some cruft behind. ‘qmailctl queue’ gives loads of ‘warning: trouble with #xxxxx: file does not exist’ after running this.

Leave a Reply

Your email address will not be published. Required fields are marked *