5/27/2558

How to Delete Old Email from Exim Mail Queue

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 -Mrm
The 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.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

ท่านสามารถแสดงข้อคิดเห็นที่เหมือน หรือ แตกต่างได้ครับ ขอความกรุณาใช้ถ้อยคำที่สุภาพด้วยครับ ขอบคุณครับ