Basically, there are times when a particular domain in your server is involved in spamming or excessive mail delivery and you just want to block that domain alone from sending mails.  With the current setup with cPanel, it is not straightforward to establish this.

We will see how to do this step-by-step.

First, login to your WHM and navigate to, Home »Service Configuration »Exim Configuration Manager » Advanced editor

Find the portion “ROUTERS CONFIGURATION” and right under the section – PREROUTERS, give the following piece of code :

reject_domains:

driver = redirect
# RBL Blacklist incoming hosts
domains = +exim_blacklist
allow_fail
data = :fail: Connection rejected: Sorry dude :/

Once this is done, save the configuration.

Next, SSH to your server and open the file /etc/exim.conf for editing.

Open it and right after the first line (usually it is something like)  “#!!# cPanel Exim 4 Config”,  give in the following and save the file :

domainlist exim_blacklist = lsearch;/etc/eximblacklist

Save the file and restart exim.

Now, all you need to do is enter the concerned domain(s) in the file ‘/etc/eximblacklist‘ ( one domain – each line )

Now, when you test to see if you can send a mail from the domain, the following can be seen in logs :

DATE H=localhost (xxxxx]:44411 sender verify fail for <test1@domain.com>: Connection rejected: Sorry dude :/

This is it, do you still face any issue ? Post a comment below with the error / issue you get !