How to Delete Old Email from Exim Mail Queue
18 September 2006
Exim mail queue is one of the most important things to monitor in the hosting server. Web server with many shared hosting has more possibility to produce a huge numbers of emails in the Exim mail queue. And if you read those messages especially the old one, you will realize that most of them are junk or spam bouncing emails.
I did have the same problem and I had followed many suggestions to handle this problem including tweak the Exim configuration. Although Exim is supposed to delete email which more than 7 days old, sometimes for unknown reasons you still can find so many older mail left in your Exim mail queue.
Exim will try to resend those emails for certain periods. Too many mails in queue can take a lot of cpu resources, so you need to maintain the numbers of messages in your Exim mail queue.
Here is the manual but effective way to clean up the old messages in you Exim mail queue:
- Login to your server as a root user.
- Run the following command:
exiqgrep -o 86400 -i | xargs exim -MrmThe above command will delete the messages older than 1 day. To delete email more than one day you can multiply with the number of days with 86400.
Depends on how many messages in your Exim mail queue, this command may take a while to complete. If for some reason you find a locking error then your server might just in the middle of trying to resend process of those emails. Take a few moments before you try again.
Good luck.
15 June 2007
What an absolutely excellent article.
I thank you very much for having taken the time to share your knowledge and experience.
I am really grateful. This helped me so much.
Please allow me to quote the first few lines of your article on our forums on http://talkaboutislam.com and to send the visitors to continue reading on your site here.
16 June 2007
Glad to know that this article can help you. Permission granted.
15 March 2008
Thank you very much – that is exactly what I was looking for.