{"id":1424,"date":"2024-10-07T10:32:44","date_gmt":"2024-10-07T05:02:44","guid":{"rendered":"https:\/\/lookouthost.com\/blog\/?p=1424"},"modified":"2024-10-07T10:32:46","modified_gmt":"2024-10-07T05:02:46","slug":"how-to-block-emails-by-domain-in-exim-and-whm","status":"publish","type":"post","link":"https:\/\/lookouthost.com\/blog\/how-to-block-emails-by-domain-in-exim-and-whm\/","title":{"rendered":"How to block emails by domain in Exim and WHM"},"content":{"rendered":"<h2 class=\"wp-block-heading\"><strong>Step 1: Create Exim blacklist file<\/strong><\/h2><p>You will need ROOT SSH access to your server, run the following command to create and open a new file in<strong>&nbsp;\/etc\/blockeddomains<\/strong>:<\/p><pre class=\"wp-block-preformatted\">nano \/etc\/blockeddomains<\/pre><p>Enter a domain name per line in the file and then&nbsp;<strong>CTRL + O<\/strong>&nbsp;and press&nbsp;<strong>ENTER<\/strong>&nbsp;to save the file.<\/p><pre class=\"wp-block-preformatted\">blockeddomain.com\ntest.com\nspam.com<\/pre><p><strong>Note:<\/strong>&nbsp;You can add more domains by following the same command and adding more domains on new lines, then restart Exim (see step 3).<\/p><h2 class=\"wp-block-heading\">Step 2: Add blacklist to Exim config<\/h2><p>You will now need to configure EXIM so that it will pick up your blacklist and process any emails against the list, ignoring any that match the domain name.<\/p><ol class=\"wp-block-list\"><li>In WHM search \u201cEXIM\u201d and click \u201cExim Configuration Manager\u201d, navigate to the \u201cAdvanced Configuration\u201d tab.<\/li>\n\n<li>Scroll down and find the BIG BLUE button labelled \u201cAdd additional configuration setting\u201d and click the button, the button should look like the image below:<br><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"61\" src=\"https:\/\/www.nileyouth.net\/images\/2019\/05\/Exim_Additional_Configuration_B.png\" alt=\"\"><\/li>\n\n<li>two input box\u2019s will appear, in the first one enter \u201cdomainlist exim_blacklist\u201d and in the second one enter \u201clsearch;\/etc\/blockeddomains\u201d.<\/li>\n\n<li>Scroll down and find the\u00a0ROUTERS CONFIGURATION section, the first section labelled \u201cSection: PREROUTERS\u201d add the following into the textarea:# Inserted to block domains access # Local from blacklist: \/etc\/exim_blacklist reject_domains: driver = redirect # RBL Blacklist incoming hosts domains = +exim_blacklist allow_fail data = :fail: Connection rejected: $domain is manually blacklisted.<\/li><\/ol><h2 class=\"wp-block-heading\">Step 3: Save Exim &amp; Restart Exim<\/h2><p>Scroll to the bottom and click save which will save all the settings and restart Exim.<\/p><p><strong>TIP:<\/strong>&nbsp;If you edit your blacklist file in future simply search WHM for Exim and click on \u201cMail Server (Exim)\u201d and click restart.<\/p>","protected":false},"excerpt":{"rendered":"<p>Step 1: Create Exim blacklist file You will need ROOT SSH access to your server, run the following command to create and open a new file in&nbsp;\/etc\/blockeddomains: nano \/etc\/blockeddomains Enter a domain name per line in the file and then&nbsp;CTRL + O&nbsp;and press&nbsp;ENTER&nbsp;to save the file. blockeddomain.com test.com spam.com Note:&nbsp;You can add more domains by following the same command and adding more domains on new lines, then restart Exim (see step 3). Step 2: Add blacklist to Exim config You will now need to configure EXIM so that it will pick up your blacklist and process any emails against the&hellip; <\/p>\n","protected":false},"author":1,"featured_media":37,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/posts\/1424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/comments?post=1424"}],"version-history":[{"count":0,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/posts\/1424\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/media\/37"}],"wp:attachment":[{"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/media?parent=1424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/categories?post=1424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lookouthost.com\/blog\/wp-json\/wp\/v2\/tags?post=1424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}