Skip to main content

How to Setup Email and Spam Filters in cPanel

In this guide we will show how to manage Email Filters, Spam Filters, and Global Filters in cPanel

Updated this week

1. Create an Email Filter per account

Email Filters in cPanel allow you to automatically manage incoming emails using rules you set. They help cut down on spam, keep messages organized, and stop unwanted emails before they ever reach your inbox.

In the “Email” section, press “Email filters“.

Here you can manage the filters of your specific already created email account. This is the user-level filter, that will be applied only for this one email.

Next, press the link “Manage Filters”:

Here press on the button “Create a new filter“:

In the line “Filter Name” enter a name for the new filter.

Then, select your filter rule:

The first set of options specifies which part of the email message the system examines to determine whether the message matches your filter parameters.

Parameter

Explanation

From

The message sender’s address

Subject

The message’s subject line.

To

The address to which the sender sent the message.

Reply Address

The address at which the sender receives replies.

Body

The message’s content.

Any Header

Any part of the message’s header

Any recipient

Any recipient of the message.

Has not been previously delivered

The system only examines messages that remain in the queue for delivery.

is an Error Message

The system only examines error messages that an auto-response system sends

List ID

The account’s mailing lists

Spam Status

Whether Apache SpamAssassin™ marked the message as spam. The Spam Status line begins with Yes or No.

Spam Bar

The content of the Spam Bar header that Apache SpamAssassin generated for this message.

The more plus signs (+) that Apache SpamAssassin assigns to a message, the greater the likelihood that the system marks the message as spam.

Spam Score

The total number of plus signs (+) in the Spam Bar value, expressed as an integer.

After you select the portion of the email message that the system will examine, select the type of comparison between that portion of the email and the criteria that you enter.

Parameter

Explanation

equals

The message exactly matches a defined string.

matches regex

The message matches a regular expression that you define.

contains

The message a string that you define.

does not contain

The message does not contain the defined string.

begins with

The message begins with the defined string.

ends with

The message ends with the defined string.

does not begin

The message does not begin with the defined string.

does not end with

The message does not end with the defined string.

does not match

The message does not exactly match the defined string.

Additional options, available only when “Spam Score” is selected:

Parameter

Explanation

is above (#s only)

The message’s Spam Score is greater than the number that you define.

is not above (#s only)

The message’s Spam Score is equal to or less than the number that you define.

is below (#s only)

The message’s Spam Score is less than the number that you define.

is not below (#s only)

The message’s Spam Score is greater than or equal to the number that you define.

Spam Score can be selected in the SpamAssasin section in your cPanel.

After selecting the Rules, in the text box write the criteria needed for the rule to work.

Select the Actions which you want to do when the rule applies:

Action

Description

Discard Message

The system discards the incoming message with no failure notice.

Redirect to email

The system forwards the message to another email address that you specify.

Fail with message

The system discards the message and automatically sends a failure notice to the sender.

Stop Processing Rules

The system skips all filter rules.

Deliver to folder

The system delivers the message to a specified folder.

Pipe to a program

The system sends the incoming message to a specified program.

This screenshot demonstrates a completed example of an email filter configuration.

At the top, a filter name is entered to identify the rule. Below that, a rule is set where the From field contains a specific email address, meaning the filter will apply to messages sent from that address.

In the Actions section, the filter is configured to Deliver to Folder, with the destination set to the spam folder. This means any email that matches the rule will be automatically moved to that folder instead of appearing in the inbox.

For more details about rules, criteria, and operators, you can check the official cPanel documentation.

After filling everything in, press the button “Create” and you will see that it is successfully created:

Please take note, that some of the filter options may not be available for selection because SpamAssasin is not enabled. You can enable it by pressing on the “Apache Spam Assasin” in the “Email” section. There press “Enable SpamAssasin”.

2. Create a Global Email Filter

Global Email Filters apply to all email accounts under your cPanel account and domain, rather than a single mailbox. They are useful for blocking common spam patterns, filtering entire sender domains, or applying consistent rules across all email addresses on the domain.

To create a global email filter, open "Global Email Filters" under the "Email" section in cPanel.

Then click "Create a New Filter":

When you create a Global Email Filter, the principle is the same as when you create a filter for a separate email account (described in the first step).

Enter a unique Filter Name so it is easy to identify later. Then set the Rules that the filter should match:

3. Manage Spam Filters (Apache SpamAssassin)

cPanel uses Apache SpamAssassin to automatically detect and filter spam emails. SpamAssassin assigns a spam score to each message based on its content, headers, and sender reputation.

To manage spam filtering, open "Spam Filters" under the "Email" section in cPanel:

You will see different Spam Filter settings:

By default, Apache SpamAssassin should be enabled. If it's not, enable it.

3.1 Spam Threshold Score

You can set the Spam Threshold Score, which determines how aggressive the filtering is. A lower score means stricter filtering, while a higher score allows more messages through. The default value is usually sufficient for most users.

To change the Threshold Score, click on "Spam Threshold Score":

Then, you can select score that you want to set up:

To save changes, click "Update Scoring Options".

3.2 Spam Box

The Spam Box feature in cPanel automatically moves emails marked as spam into a separate folder called “spam” instead of delivering them to your inbox. Messages are filtered based on their spam score, and anything exceeding the configured spam threshold is redirected there.

In the Spam Box section you can empty spam folder for particular user or empty all spam folders.

3.3 Spam Auto-Delete

The Auto Delete feature in cPanel permanently deletes incoming emails that exceed the configured spam score threshold. By default, this feature is disabled. Once enabled, messages marked as spam are removed immediately and cannot be recovered. Because of this, it’s recommended to use Spam Box instead, which stores spam in a separate folder and allows you to review or restore emails if needed.

3.4 Additional settings (For Advanced Users)

These Additional Configuration options in cPanel are meant for fine tuning the spam filter behavior.

The Whitelist lets you specify email addresses or domains that should always be delivered, even if they look like spam. This is useful for trusted senders whose messages must never be blocked.

To create a whitelist, click "Edit Spam Whitelist Settings". Then , click "+Add A new "whitelist_form" Item" and enter the email address or domain that you always want to allow:

Enter the email addresses that should always be treated as legitimate and never marked as spam. Avoid whitelisting your own domain, such as *@example.com, because this can make it easier for spammers to impersonate your domain. You can use the * and ? wildcard characters for more flexible matching.

The Blacklist allows you to block specific senders or domains completely. Emails from these sources will always be treated as spam and rejected or filtered. The process to add specific email to the blacklist is the same:

The Calculated Spam Score Settings give advanced users control over how spam scores are evaluated. You can adjust how strict the filter is for certain conditions, but most users can rely on the default settings without changes.

We strongly recommend changing spam scoring settings only if you’re an advanced user. Incorrect adjustments can lead to unexpected behavior, such as legitimate emails being blocked or spam slipping through.

Did this answer your question?