How to block accounts from sending emails – cPanel/WHM

Is it possible to block certain domains/accounts on my server for sending emails?

Yeah, 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 "" > /etc/blockeddomains

Or, open “/etc/blockeddomains” with your favorite text editor and add/append the domain into it.

# vi /etc/blockeddomains

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:


driver = redirect
domains = +blocked_domains
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, that’s it!!

Let me know if you have any questions!

Arunlal Ashok

Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *