May 122016

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 :

[[email protected] /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


Share This!
 Posted by at 3:24 pm

Sorry, the comment form is closed at this time.