Delete email in queue
Hi,
We are an Email Marketing company, we send over a million emails out every month to our subscribers and are also Return Path Certified. We recently came into an issue with our server provider with AOL and have had to block emails being sent out to AOL servers by blocking our server from connecting to AOL servers. We now have over 1 million emails in our queue and is causing our server some issues such as the following:
System Information
System Item Details Status
Server Load 66.524414 (8 CPUs)
Memory Used 97.17% (7,803,856 of 8,030,740)
Swap Used 26.73% (2,242,268 of 8,388,600)
I'm guessing this is because of Exim and our high mailing queue as we've never had this problem before. What is the best way to delete all emails in the queue to domains such as aol.com and aim.com?
Our email queue size is the following: 1,485,468.
Also how do i perform a shell command to run everyday to delete aol.com and aim.com emails from the queue so that the build up doesnt happen again? Also if theres a better way of stopping emails being sent to aol server (instead of blocking the IPs of AOL servers) then that would be great (server-side).
Any help would be much appreicated!
Thanks.
-
Hello, If you just want to reomve mail from the server mail queue then use below command to remove all AOL mails exim -bp | grep "aol.com" | awk {'print $2} | xargs exim -Mrm 0 -
I've ran the ssh commend and its been running for 2hrs and 30mins now but my mail queue is still not going down, what can i do to decrease the server load, will turning exim off help at all? if i turn it off then will the ssh command still work? Its done nothing for over 2hrs now :( PS: i ran the code before it was posted as i found how to do it around 5mins after posting this topic. Thanks, Mike 0 -
Hello Marlow, Saw your query on clearing up the exim queue and I would recommend to make use of a custom script that will run as a cron job everyday. 1. Create a file to specify the domains: /usr/local/src/mail_domains.txt eg. You can add "aol.com" and "aim.com" to this file. Also, you can add "frozen" or "<>" into this file if you wish to clear frozen mails from the queue. 2. Next create a custom script with contents given below: /root/clear_queue.sh ####### #!/bin/bash ##Read the domains for i in `cat /usr/local/src/mail_domains.txt` do sleep 5 ##Clear the mails with respect to each domain exim -bpr | grep "$i" | awk {'print $3'} | xargs exim -Mrm sleep 5 done ######
3. Give the script executable permission chmod 755 /root/clear_queue.sh 4. Run the script as a cron job, (Assuming 11:00 PM is your off-peak hours) Edit the cron jobs: crontab -e Then add the following cron job as below:0 23 * * * /root/clear_queue.sh >/dev/null 2>&1
Final note: The above method will be an unattended method to clear up all the mails. Regarding your query with high load in the server, it is because that the entire mail queue has to be processed where at the same time the queue is growing. If by any circumstance the load becomes too high to manage and the servers goes down due to it, we have to implement a different strategy by removing the queued mails from the directory. Please review the above and let me know your thoughts. Off topic: Also, how do you manage to keep your mail IP from blacklisting or do you make use of any IP rotation. Warm Regards, Vishnu Pradeep0 -
Hello, You can setup a custom Exim system filter that rejects messages sent to certain domain names. Information on how to setup a custom Exim system filter is available at: How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation This document is useful when setting up custom filter rules: How to Configure Mail Filters - cPanel Knowledge Base - cPanel Documentation You may also find these links helpful: Delete mails in queue with terminal How to Prevent Email Abuse - cPanel Knowledge Base - cPanel Documentation Thank you. 0
Please sign in to leave a comment.
Comments
4 comments