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:

Code:
touch /etc/blockeddomains
echo "domain.com" >> /etc/blockeddomains

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

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

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

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

Put the following lines:

Code:
reject_domains:

driver = redirect
# RBL Blacklist incoming hosts
domains = blocked_domains
allow_fail
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

Noice!

g33kadmin

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