Limited offer: Get 50% OFF on monthly VPS Hosting plans!

How to configure Email filters in cPanel

Estimated reading time: 3 min

Article Summary

General information

  • Email filtering is an efficient way to manage the incoming and outgoing messages of any given account on your domain.
  • As a general rule of thumb, it is best to add multiple simple filtering rules, as opposed to one big complex rule. This will allow the Email server to process rules  easier and more accurately.

How to configure Email filters in cPanel

  • First and foremost, Log in to your cPanel account.
  • You can configure Email filters by choosing between the following options:
    • Global Email Filters (or account level filtering)
    • Email Filters (or user level filtering)

Email Filter Selection

 Global Email Filters

    • This interface allows you to configure Email filters which will apply unilaterally to all user accounts (for example all user accounts created under one domain).
    • To create a global filter, first click on Global Email Filters and then on Create a New Filter.

Create new global email filter

    • You will be redirected to the window bellow, where you can edit the actual filter by giving it a Name (1), selecting the Rules (2), choosing the Criteria (3), entering a string Value (4) and consequently telling the filter what Action to take (5).
    • Notice how you can add one or more Rules and Actions on your filter (6*) ? This is optional.
    • When you’re done setting up the rules, simply click on Create (7).

configure global email filter

    • After you’ve created the new filter rule, a confirmation message will appear on the screen.

gobal email filter confirmation

  • Navigating back, you will see the Filter list where you can test the filters you just made. Simply click on Test Filter and follow your inbox.

Test email filters

Email Filters

    • Email filters allow you to add and manage filters for each email account.
    • Setting up Email filters for individual users is similar with the global Email filters.
    • First start by clicking on Email Filters from the Email section of your cPanel dashboard. Secondly, go to Manage Filters for the desired user account.

manage email filters

  • Next, click on Create a New Filter and follow the same steps as explained in the previous section.

Note: in addition, when you manage filter lists, you can change their order by dragging them around, edit or delete them.

Setting up the filter

In this section we will explain how to choose and configure the filter rules, criteria and actions.

If you do this correctly, the filter will perform as you want it to. Otherwise, it will most likely do nothing.

Rules

configure email filter Rules

  • From: specifies the sender’s Email address.
  • Subject: specifies the subject line from any incoming Email message.
  • To: specifies the recipient’s Email address .
  • Reply: specifies the Email address at the sender receives replies .
  • Body: specifies the entire content of the message.
  • Any Header: specifies any part of the message header.
  • Any Recipient: specifies any recipient of the message.
  • Has Not Been Previously Delivered: the server will only analyze messages that have remained in the delivery cue.
  • Is an Error Message: the server will only analyze error-messages sent by auto-reply systems.
  • List ID: will contain the mailing lists of the account.
  • Spam Status: whether the Apache Spam Assassin has marked the message as Spam. This option demands a string value of “YES” or “NO” in the value box.
  • Spam Bar: this is similar to a risk indicator. The more plus (+) sings the Spam Assassin attributes to a message, the more likely it is that it will be marked as Spam.
  • Spam Score: indicates you the total number of (+) signs in the Spam Bar, expressed as a number.

Note: in order for the Spam Status, Spam Bar and Spam Score to be available, you must make sure that the Apache Spam Assassin is enabled.

Criteria

configure email filter criteria

  • Contains: specifies a user defined string to search for
  • Matches regex: matches a user defined regular expression
  • Does not contain: the message does not contain a user defined string
  • Equals: the message is exactly the same as the entered 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 match the defined string
  • Is above (numbers only): message value is above a given integer
  • Is not above (numbers only): message value is not above a given integer
  • Is bellow (numbers only): message value is below a given integer
  • Is not bellow (numbers only): message value is not bellow a given integer

Actions

After the system matches the predefined rules and criteria, it must decide what to do with that specific email. This is where the following actions come in to play.
choose email filter action

  • Discard Message: it will automatically discard (drop) the message without failure notice.
  • Redirect to Email: it will redirect (forward) the message to another user defined Email account.
  • Fail With Message: the system will automatically discard the message and return a specific failure notice to the sender.
  • Stop Processing Rules: it will stop processing any further rules.
  • Deliver to Folder: it will move the message to a specified folder.
  • Pipe to a Program: it will send the message to a particular software or program.

In conclusion, the advantage of setting up Email filters directly from cPanel is that you can preset user defined specifications remotely. This will consequently enable them to remain activated regardless of the location or device the user is accessing his or hers’ Emails from.

Make sure you test them out and set up more complex rules combinations to see how they are processed.

Was this article helpful?
No 0