Knowledge Base

How to configure e-mail filtering in cPanel

This article describes how to set up e-mail filters in cPanel.

About e-mail filters

You can use e-mail filters to block unwanted messages based upon a certain set of conditions. For example, you can specify that messages containing a certain word or phrase are deleted automatically or routed to another e-mail address. The e-mail filters that you create are cumulative: if a message passes through one filter, it can still be blocked by a subsequent filter.

There are two types of e-mail filters that you can create:

  • E-mail filters: You can configure filters for specific e-mail accounts.
  • Global e-mail filters: You can configure filters that apply to all e-mail accounts for a domain.

Creating an e-mail filter

To create an e-mail filter, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the EMAIL section of the cPanel home screen, do one of the following:
    • To create a filter for a specific e-mail account, click Email Filters:

      cPanel - Email - Email Filters icon

      Locate the account for which you want to add a filter, and then click Manage Filters.

    • To create a global e-mail filter, click Global Email Filters:

      cPanel - Email - Global Email Filters icon

  3. Click Create a New Filter.
  4. In the Filter Name text box, type the filter name.

    You should use a filter name that is easily identifiable so you can tell what the filter's purpose is. Also, filter names must be unique; you cannot use duplicate filter names.
  5. Under Rules, specify the filter rules. For example, to filter e-mail messages that contain the word buy in the subject:

    • In the first list box, select Subject.
    • In the second list box, select contains.
    • Type buy in the text box.
    Filters use strict logic in determining how to handle messages. Make sure that your filter rules are not too broad. Otherwise, you may unintentionally block messages that you want to receive. Also, the text in rules is not case-sensitive. A rule that specifies buy and a rule that specifies BUY are equivalent.
  6. Click the + icon to add another rule.

    You can add as many rules as you want. For example, the sample rule in step 5 blocks all messages that contain the word buy in the subject. This is a very broad rule that will likely block some legitimate messages. You can add another rule that specifies the word now in the subject. Select and in the list box. The filter will now match any message that contains the words buy and now in the subject line.
  7. Under Actions, select the action for the filter to perform if the rule conditions are matched. You can specify multiple actions. To do so, click the + icon to add another action.
  8. Click Create. cPanel creates the filter.

Testing an email filter

After you have created a filter, you should test it to make sure that it filters what you intended.

To test an email filter, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the EMAIL section of the cPanel home screen, do one of the following:
    • To create a filter for a specific e-mail account, click Email Filters:

      cPanel - Email - Email Filters icon

      Locate the account for which you want to add a filter, and then click Manage Filters.

    • To create a global e-mail filter, click Global Email Filters:

      cPanel - Email - Global Email Filters icon

  3. In the Filter Test text box, type a test e-mail message.
  4. Click Test Filter. The Filter Trace Results page shows if any rule conditions were met, and whether or not any actions will be taken.

Editing or deleting an email filter

After you have created a filter, you can edit it or delete it.

To edit or delete an email filter, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the EMAIL section of the cPanel home screen, do one of the following:
    • To create a filter for a specific e-mail account, click Email Filters:

      cPanel - Email - Email Filters icon

      Locate the account for which you want to add a filter, and then click Manage Filters.

    • To create a global e-mail filter, click Global Email Filters:

      cPanel - Email - Global Email Filters icon

  3. Under Current Filters, locate the filter you want to edit or delete.

    • To edit the filter, click Edit. The Edit a Filter page is almost identical to the page that you use to create a filter.
    • To delete the filter, click Delete, and then click Delete Filter to confirm the deletion.