cPanel

How to block outgoing emails of an account in cPanel

Outgoing Emails
Block Outgoing Emails

Block Outgoing Emails of a Domain in cPanel

This tutorial will help you to block outgoing emails of a domain in cPanel server.You can use two methods to block the outgoing email of an account. Please see the two methods below:

Method 1

Initially, we need to create a list of domains to block the outgoing emails in the server.

 
vim /etc/blockeddomains

Add the domain names which you would like to block the outgoing email traffic one in a row.

Correct the permissions and ownership of the mentioned file.

 
chown root.mail /etc/blockeddomains 
chmod 640 /etc/blockeddomains

Then go into WHM > Service Configuration > Exim Configuration Manager > Advanced Editor

Find “Add additional configuration setting” button and click on it. A new box will appear above the button and add the following in it.

 
domainlist blocked_domains = lsearch;/etc/blockeddomains

Block domains from sending email

Then, search for “Section: ROUTERSTART” and add the following:

 
reject_domains: 
driver = redirect
domains = +blocked_domains
allow_fail
data = :fail: Connection rejected: SPAM source $domain is manually blacklisted.

Then save the configuration.

Method 2

You can Block domains from sending email in cPanel server using WHM API Functions too. Please run the following command:

whmapi1 suspend_outgoing_email user=example

Replace “example” with the desired desired username. cPanel introduced this functionality in cPanel version 11.52.0.8.

Also, you can unsuspend the email fuctionality using the following command:

whmapi1 unsuspend_outgoing_email user=example

You can also hold the outgoing emails using the following command:

whmapi1 hold_outgoing_email user=example

To release outgoing emails:

whmapi1 release_outgoing_email user=example

Please note that the method 2 only works on cPanel versions higher than 11.52.0.8.

That’s it!

Also Read: Block outgoing email of a domain in Plesk

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

2 Comments

Click here to post a comment

Topics