How Do I Block One Domain From Sending Email From My Server? | cPanel Forums

Source: How Do I Block One Domain From Sending Email From My Server? | cPanel Forums

You can try the following steps. First, in root SSH, run these commands:

touch /etc/blockeddomains
echo "" >> /etc/blockeddomains

Please replace with the domain name. Do not replace the “” part as that’s required, only the part with the right domain name.

In WHM > Exim Configuration Editor > Advanced Editor, put the following in the topmost box:

domainlist blocked_domains = lsearch;/etc/blockeddomains
Locate the “ROUTERS CONFIGURATION” section, and right below these lines:

driver = redirect
require_files = "+/etc/demouids"
condition = "${if eq {${lookup {$originator_uid} lsearch {/etc/demouids} {$value}}}{}{false}{true}}"
data = :fail: demo accounts are not permitted to relay email

Put the following lines:


driver = redirect
# RBL Blacklist incoming hosts
domains = blocked_domains
data = :fail: Connection rejected: SPAM source $domain is manually blacklisted.

Then, when trying to delete all messages from the spammy user you’ll see :

[root@host /home/spammyuser/public_html]# exim -bp | grep 'spammyuser' | awk '{print $3}' | xargs exim -Mrm
Message 1b0uv7-004IeB-Ci is locked (mail that was in the queue)
Message 1b0uvC-004IfV-2V is locked
Message 1b0uuC-004IBU-Ja has been removed
(mail that was in the queue that was deleted)
Message 1b0uuC-004IBb-UZ has been removed
Message 1b0uuQ-004IGx-IJ has been removed
Message 1b0uuQ-004IHR-UT has been removed
Message 1b0uul-004INM-0i has been removed
Message 1b0uun-004IPX-W8 has been removed
Message 1b0uv7-004IeB-Ci is locked



I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....