WebHostingPeople Blog

  • Domains
    • Shared Hosting

  • Cloud VPS
  • Servers
    • Client Area Login

How Can We Help?

Block Email from a Country or Domain in cPanel

You are here:

The safety of email involves the various measures that can be employed to protect the content and accessibility of an email service or account. In cPanel, a new feature has been introduced to block email from a country or domain. This feature allows you to prevent emails from a specific country or domain on a server-wide or per-user basis. By utilizing the email block feature in cPanel, you can effectively prevent spam and unsolicited messages from reaching your email account. If you suspect that the spam in your email account is originating from a certain country or domain, you can choose to block all emails from that specific location using the email block feature in cPanel. This knowledgebase article provides instructions on how to block email from a country or domain in cPanel.

Configure Mail Filters

You can customize your email handling by configuring email filters. In cPanel, you have the ability to configure both global email filters and user-level filters.

Global Email Filters: The global email filters interface allows you to set rules for all email addresses associated with the cPanel account. To access this interface, navigate to cPanel >> Home >> Email >> Global Email Filters.

Email Filters: The Email Filters interface enables you to set rules for specific email addresses on the cPanel account. To access this interface, navigate to cPanel >> Home >> Email >> Email Filters.

Configure the Apache SpamAssassin Report_Safe Option

If an email fails the spam test, you can choose to be notified through the Apache SpamAssassin Report_Safe option. This option can be configured in the ‘/etc/mail/spamassassin/local.cf’ global configuration file. Follow the steps below to configure the Report_Safe option.

1) Enable the Old-Style Spam System Setting

Please note that the old-style spam system setting is not available in cPanel & WHM version 54. Enabling this setting in cPanel & WHM version 11.52 and earlier will prevent Exim from overriding any changes made to the global configuration file.

1) Log in to WHM as the root user and go to ‘Service Configuration’.

2) Navigate to WHM’s ‘Exim Configuration Manager’ interface and select the ‘Apache SpamAssassin’ options tab.

3) Enable the Old-Style Spam System Setting.

4) Save your changes.

2) Edit the Global Apache SpamAssassin Configuration file

To enable Apache SpamAssassin, you can modify the ‘Report_Safe’ value in the ‘/etc/mail/spamassassin/local.cf’ file. Depending on your requirements, you can add the following values:

Value Description
0 Display SPAM rules in the email header and keep the message body intact.
1 Include the following attachments:

1) Suspected spam email
2) Document with detailed spam rule offense
2 The email body includes the spam rule offense text, and the following attachments are added:

1) Suspected spam email
2) Document with detailed spam rule offense

How to Block Emails by Country or Domain

With the latest release in cPanel, a new feature has been introduced to block emails by country or domain. There are two interfaces you can use to block email messages:

1) Filter Incoming Emails by Country

1) Log in to WHM as the root user and navigate to the ‘Email’ section.

2) Select the ‘Filter Incoming Emails by Country’ option.

Using this interface, you can filter your incoming emails based on region or country. By utilizing this interface, you have the ability to allow only mail from a specific country, effectively blocking emails from other countries.

To block emails from a specific country, you can disable the Allowed toggle for that country in the Nations table. To allow or block all countries, follow the steps below:

1) Select the ‘Select All’ checkbox at the top left of the interface.

2) Click ‘Allow Selected’ to allow all selected countries.

3) Alternatively, you can click ‘Block Selected’ to block them.

2) Filter Incoming Emails by Domain

1) Log in to WHM as the root user and navigate to the ‘Email’ section.

2) Select the ‘Filter Incoming Emails by Domain’ option.

Using this interface, you can block emails from a specific domain. When you specify a domain in this interface, your server will reject email messages where the ‘From’ address matches a blocked domain. This feature is useful for blocking emails from a domain that exclusively sends spam.

To block a domain, follow these steps:

1) Add the domain details in the ‘Blocked Domains’ text box. For multiple domains, use a new line for each domain.

2) Click ‘Save’.

To block all emails from subdomains of a specific domain, prefix the domain name with an asterisk (*) in the ‘Blocked Domains’ text box. This wildcard character will reject any emails from subdomains as well. For example, if you enter ‘*.test.com’ in the ‘Blocked Domains’ text box, your server will reject any email messages from subdomains such as abc.test.com, xyz.test.com, and so on.

Conclusion

Email spamming is a widely recognized method of spamming. It is crucial to protect your email accounts and services from spam. The email block feature in cPanel allows you to effectively block emails from a specific domain or country. We hope this knowledgebase article has been helpful. If you have any questions or queries, please leave a comment below. If you are a customer of InternetHostingPeople, please contact our support team for further assistance.

Post Your Comment