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 an e-mail 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:

  • User-level filtering: You can configure e-mail filters for specific e-mail accounts.
  • Account-level filtering: You can configure e-mail filters that apply to all e-mail accounts for the domain.

Creating an e-mail filter

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

  1. In the Mail section of the cPanel home screen, click User Level Filtering or Account Level Filtering.
  2. If you are configuring a user-level filter, 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 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 that the filter should perform if rule conditions are matched. You can specify multiple actions.
  8. Click Create.

Testing an e-mail filter

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

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

  1. In the Mail section of the cPanel home screen, click User Level Filtering or Account Level Filtering.
  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 e-mail message.
  4. Click Test Filter. The Filter Trace page shows if any rule conditions were met, and whether or not any actions will be taken.

Editing or deleting an e-mail filter

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

To edit or delete an e-mail filter, follow these steps:

  1. In the Mail section of the cPanel home screen, click User Level Filtering or Account Level Filtering.
  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.