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
Thanks 🙂
Although… It does leave some cruft behind. ‘qmailctl queue’ gives loads of ‘warning: trouble with #xxxxx: file does not exist’ after running this.
Ouch, this was 9 years ago 🙂 … somethings must have changed since 😉