Is it possible to block certain domains/accounts on my server for sending emails?
It’s possible to block certain domains from sending emails from server. There is an option in Exim configuration on your cPanel server to block domains from sending emails. This can be done by adding those domains into “/etc/blockeddomains” this configuration file.
Here I’m going to explain the steps to block accounts from sending emails. You must have a server with root access to do so.
The steps are explained below:
1. SSH to server as root.
2. Check the file “/etc/blockeddomains” is existing on the server. If it’s not there create one.
3. Add domains in “/etc/blockeddomains” to cut the email sending privilege.
You can use the following commands:
# echo "thedomain.com" > /etc/blockeddomains
Or, open “/etc/blockeddomains” with your favorite text editor and add/append the domain into it.
# vi /etc/blockeddomains thedomain.com
4. Set correct ownership to “/etc/blockeddomains.”
# chown root.mail /etc/blockeddomains
5. Set correct permission.
# chmod 640 /etc/blockeddomains
6. Then log into the WHM panel and go to “EXIM Configuration Manager.”
WHM –> Service Configuration –> EXIM Configuration Manager –> Advanced Editor
Search for “Add additional configuration setting.” This can be located one by forth of the way of scroll down
Add the following entry:
domainlist blocked_domains = lsearch;/etc/blockeddomains
7. Search for “ROUTERSTART” and add the following entry:
reject_domains: driver = redirect domains = +blocked_domains allow_fail data = :fail: Connection rejected: SPAM source $domain is manually blacklisted.
This should be look like:
Yeah, that’s it!! Next time if you want to block another domain from sending emails, just add that domain into “/etc/blockeddomains” this file,