Skip to main content

Delete email in queue

Comments

4 comments

  • SysSachin
    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
  • marlowmedia
    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
  • Vishnu Pradeep
    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 Pradeep
    0
  • cPanelMichael
    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.