Global Email Filters

Valid for versions 82 through the latest version

Version:

82


Last modified: January 21, 2022

Overview

This interface allows you to configure how your server filters all of the email that your domains’ email accounts receive.

Important:
  • We strongly recommend that you use multiple, simple filters instead of a single large filter. Exim, the server’s mail transfer agent, handles many small rules more efficiently than a single large rule.
  • For more information about cPanel’s email filter rules and actions, read our How to Configure Mail Filters documentation.
Note:

Generally, the recipient does not receive the BCC field in an email’s header. For this reason, you cannot use the BCC field in a filter.

Create a filter

To create a new filter, perform the following steps:

  1. Click Create a New Filter.
  2. Enter the filter’s name in the Filter Name text box.
  3. Configure your filter’s rules and actions.
    Note:

    For more information, read our How to Configure Mail Filters documentation.

  4. Click Create.

Create a wildcard redirect

A wildcard redirect will redirect all emails whose addresses match a regular expression (regex) pattern.

Important:

Forwarders deliver copies of a forwarded email to both the original and the destination address, while redirects only deliver emails to the destination address. For example, redirecting an email from [email protected] to [email protected] will result in it only being available in the [email protected] inbox.

To create a wildcard redirect, perform the following steps:

  1. Click Create a New Filter.
  2. Enter the wildcard filter’s name in the Filter Name text box.
  3. Select From from the Rules menu to apply your new filter to the sending email address.
  4. Select matches regex from the Operators menu to compare the sending email address to your regex pattern.
  5. Enter your regex pattern in the Criteria text box.
    Note:

Current Filters

The Current Filters section lists all of the account-level filters for your cPanel account.

Edit a filter

To edit an existing filter, perform the following steps:

  1. Click Edit next to the appropriate filter name.
  2. Make the desired changes to the filter.
  3. Click Create.

Delete a filter

To delete a filter, perform the following steps:

  1. Click Delete next to the appropriate filter name.
  2. Click Delete Filter.

Test a filter

Important:

To learn more about your filter’s rules and actions, read our How to Configure Mail Filters documentation.

To test your filter, perform the following steps:

  1. Enter a test email message in the Filter Test text box.

    Note:
    Include the characters, words, and conditions that you configured for your filter.

  2. Click Test Filter. The Filter Trace Results interface will appear.

The Filter Trace Results interface

The Filter Trace Results interface will display results similar to the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Sub-condition is false: not first_delivery
Condition is false: not first_delivery and error_message
Condition is false: $message_body contains Keyword
Return-path copied from sender
Sender      = username@hostname.example.com
Recipient   = username@hostname.example.com
Testing Exim filter file "/home/example/etc/example.com/filtertest/filter"

Headers charset "UTF-8"
Filtering did not set up a significant delivery.
Normal delivery will occur.

The results contain the following information:

  • Each condition in the filter, and whether it returned a true or false result.
  • The Sender and the Recipient of the test message.
  • The filter file’s name.
  • The character set of the message.
  • Whether the filter triggers a change in delivery or if it will deliver normally.
    • Filtering did not set up a significant delivery. Normal delivery will occur. — The system will deliver the message to the mailbox.
    • Filtering set up at least one significant delivery or other action. No other deliveries will occur. — The system will deliver the message to another mailbox or folder, or it will not deliver the message.

Additional Documentation