Delete Spam from Exim Queue
Spam is a major cause of headache for many people in the world. Especially server administrators.
Here is a tip to clean up your exim mail queue if its getting to large and full of spam.
Please keep in mind that some legitimate emails may get deleted by this method. Please use it carefully. I had more than 2000 emails in my queue, and it was reduced to about 50 after running a few of these.
First, run
grep -R -l [SPAM] /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm
The highlighted word will be used in a grep search and replace and all messages matching that will be deleted. If you also want to remove frozen messages from your queue, run the following
grep -R -l ‘*** Frozen’ /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm
You can perform one more that will also clean your exim queue some more
grep -R -l ‘The recipient cannot be verified’ /var/spool/exim/msglog/*|cut -b26-|xargs exim -Mrm
Second tip – if you are using CPanel, set up your mails to default to :fail: rather than :blackhole:
References:
- Thank you to Khalid for his regular expression on his blog post Deleting Emails in Exim
Related Reading:
Other Interesting Posts
2 Responses to Delete Spam from Exim Queue
Leave a Reply Cancel reply
-
Articles
- January 2011
- April 2010
- March 2010
- February 2010
- January 2010
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- February 2009
- December 2008
- November 2008
- October 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
-
Meta








plz i have problem in my exchange server 2003 i can’t send any mail to outside it’s give me this error
The following recipient(s) could not be reached:
samos.256@hotmail.com on 23/02/2009 04:06 ?
There was a SMTP communication problem with the recipient’s email server. Please contact your system administrator.
i need to solve it soon i can’t delete the spam in my queue
plz help
just had a user account password stolen by spammers, had thousands of messages in the queue. worked like a champ, thanks.