Knowledge Base

How to configure email filtering in cPanel

This article describes how to set up email filters in cPanel.

About email filters

You can use email 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 -mail address. The email filters that you create are cumulative: if an email message passes through one filter, it can still be blocked by a subsequent filter.

There are two types of email filters that you can create:

  • Email Filters: You can configure email filters for specific email accounts.
  • Global Email Filters: You can configure email filters that apply to all email accounts for the domain.

Creating an email filter

To create an email filter for an email account, follow these steps:

  1. In the Email section of the cPanel home screen, click Email Filters or Global Email Filters.
  2. If you are configuring a user-level filter, select Email Filters. Then, locate the account for which you want to add a filter, and then click Manage Filters.
  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 email 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 that the filter should perform if rule conditions are matched. You can specify multiple actions. To do so, click the + icon to add another action.
  8. Click Create.

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. In the Email section of the cPanel home screen, click Email Filters or Global Email Filters.
  2. If you are configuring a user-level filter, locate the account that has the filter you want to test, and then click Manage Filters.
  3. In the Filter Test text box, type a test email 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. In the Email section of the cPanel home screen, click Email Filters or Global Email Filters.
  2. If you are configuring a user-level filter, locate the account that has the filter you want to edit or delete, and then click Manage Filters.
  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.