{"id":809,"date":"2024-06-07T11:13:50","date_gmt":"2024-06-07T11:13:50","guid":{"rendered":"https:\/\/linuxresellerwebhosting.in\/blog\/?p=809"},"modified":"2024-06-08T11:19:55","modified_gmt":"2024-06-08T11:19:55","slug":"pending-mail-in-the-exim-queue","status":"publish","type":"post","link":"https:\/\/linuxresellerwebhosting.in\/blog\/pending-mail-in-the-exim-queue\/","title":{"rendered":"How do I delete the pending mail in the Exim queue?"},"content":{"rendered":"<p>To delete pending mail in the Exim mail queue, you need to use Exim&#8217;s command-line tools. Here&#8217;s a step-by-step guide:<\/p>\n<p><strong>List the Mail Queue<\/strong>: Before deleting any mail, it\u2019s useful to see what\u2019s in the queue.<\/p>\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<pre class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">exim -bp<\/pre>\n<\/div>\n<div><\/div>\n<div>This command lists all the messages currently in the queue.<\/div>\n<h3><span class=\"ez-toc-section\" id=\"Pending_mail_in_the_Exim_queue\"><\/span><span class=\"tagify__tag-text\" contenteditable=\"true\" spellcheck=\"false\" data-lt-tmp-id=\"lt-354835\" data-gramm=\"false\">Pending mail in the Exim queue<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxresellerwebhosting.in\/blog\/pending-mail-in-the-exim-queue\/#Pending_mail_in_the_Exim_queue\" >Pending mail in the Exim queue<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxresellerwebhosting.in\/blog\/pending-mail-in-the-exim-queue\/#Additional_Tips\" >Additional Tips<\/a><\/li><\/ul><\/nav><\/div>\n\n<div><strong>Delete All Messages in the Queue<\/strong>: To delete all pending emails in the queue, use:<\/div>\n<div><\/div>\n<pre>exim -bp | exiqgrep -i | xargs exim -Mrm<\/pre>\n<div><\/div>\n<div>\n<ul>\n<li>\n<ul>\n<li><code>exim -bp<\/code> lists the queue.<\/li>\n<li><code>exiqgrep -i<\/code> extracts the message IDs.<\/li>\n<li><code>xargs exim -Mrm<\/code> removes the messages with the extracted IDs.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<div>\n<p><strong>Delete Specific Messages<\/strong>: If you want to delete specific messages, first get their IDs using:<\/p>\n<pre>exim -bp<\/pre>\n<p>Then delete them individually using:<\/p>\n<pre>exim -Mrm &lt;message-id&gt;<\/pre>\n<p>Replace <code>&lt;message-id&gt;<\/code> with the actual ID of the message you want to delete.<\/p>\n<p><strong>Delete Frozen Messages<\/strong>: Sometimes you may want to delete only frozen messages (emails that couldn&#8217;t be delivered and are not being retried).<\/p>\n<pre>exim -bp | grep frozen | awk '{print $3}' | xargs exim -Mrm<\/pre>\n<p>This command pipeline finds all frozen messages and removes them.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Additional_Tips\"><\/span>Additional Tips<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><strong>Check for Exim Version<\/strong>: Ensure you are using the correct commands for your version of Exim. Some commands might slightly differ.<\/li>\n<li><strong>Automation with Scripts<\/strong>: If you need to perform this task regularly, consider writing a script and scheduling it with cron.<\/li>\n<\/ul>\n<p>Here\u2019s an example script to delete all frozen messages, which you can save as <code>clean_exim_queue.sh<\/code>:<\/p>\n<pre>#!\/bin\/bash\r\n# Script to clean up Exim mail queue\r\n\r\n# Delete frozen messages\r\nexim -bp | grep frozen | awk '{print $3}' | xargs exim -Mrm\r\n\r\n# Optionally, delete all messages (uncomment the following lines if needed)\r\n# exim -bp | exiqgrep -i | xargs exim -Mrm<\/pre>\n<p>Make the script executable:<\/p>\n<pre>chmod +x clean_exim_queue.sh<\/pre>\n<p>You can then set up a cron job to run this script periodically. For example, to run it every day at midnight, add the following line to your crontab:<\/p>\n<pre>0 0 * * * \/path\/to\/clean_exim_queue.sh<\/pre>\n<\/div>\n<div>By following these steps, you can effectively manage and clean the pending <a href=\"https:\/\/www.squarebrothers.com\/email-hosting-india\/\" target=\"_blank\" rel=\"noopener\">mail<\/a> in the Exim queue.<\/div>\n<div><\/div>\n<div>To know about How to configure and download raw access logs in cPanel<a href=\"https:\/\/linuxresellerwebhosting.in\/blog\/configure-access-logs-in-cpanel\/\"> click here.<\/a><\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>To delete pending mail in the Exim mail queue, you need to use Exim&#8217;s command-line tools. Here&#8217;s a step-by-step guide:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[1],"tags":[],"class_list":["post-809","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=809"}],"version-history":[{"count":7,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/809\/revisions"}],"predecessor-version":[{"id":816,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/809\/revisions\/816"}],"wp:attachment":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}