Account and user level filters control how your incoming email is handled, helping to ensure that you receive more mail and less spam. cPanel allows you to manage filters for each email account on your domain. This can be useful for discarding spam, redirecting mail or piping messages to a program.
To add an account or user level filter:
1. Login to the cPanel.
2. In the Mail section, click Account Level Filtering or User Level Filtering according to your preference.
3. For a user level filter, click Manage Filters.
4. Click on Create a New Filter.
5. In the Filter Name field, enter a name for the filter.
6. In the first drop-down menu under Rules, select a message characteristic.
From - address from which the message was sent
Subject - the subject line of the message
To - address to which the message was sent
Reply Address - address to which the reply will be sent
Body - body or content area of the message
Any Header - a header of the message
Any recipient - a recipient of the message
Has not been previously delivered - affects messages still in queue for delivery
is an error message - affects error messages received from an auto-response system
Spam Status - the status SpamAssassin has been conferred on the message; it begins with either "Yes" or "No."
Spam Bar - the content of the Spam Bar header that SpamAssassin has generated for this message. This header contains plus (+) signs to denote the likelihood that the message is spam; more plus signs means the message is more likely spam.
Spam Score - the overall spam score assigned to the message by SpamAssassin, expressed in digits.
7. In the adjacent drop-down menu, select an operator.
equals - exactly matches the string you define
matches regex - matches a regular expression you define
contains - contains the string you define
does not contain - does not contain the string you define
begins with - begins with the string you define
ends with - ends with the string you define
does not begin - does not begin with the string you define
does not end with - does not end with the string you define
does not match - is not equal to the string you define
The following options are only applicable when the Spam Score option is selected:
is above (#s only) - scores greater than the number you define will be subject to the action selected
is not above (#s only) - all scores equal to or less than the defined number will be subject to the action selected
is below (#s only) - all scores below the defined number will be subject to the action
is not below (#s only) - all scores greater than or equal to the specified number will be subject to the action
8. Under the Rules section, in the second long box enter the filter or characteristics you wish to use as the filter. For e.g. email@example.com.
(Regular expressions are accepted).
This rule will target any emails from the sender firstname.lastname@example.org
You can add and remove rules by clicking the +/- buttons.
9. In the Actions drop-down menu, select an action for the rule you created.
Discard message - destroys the incoming message with no failure notice
Redirect to email - redirects the message to another email address that you specify
Fail with message - discards the message and automatically returns a specified failure notice to the sender
Stop processing rules - skips all filter rules
Deliver to folder - deposits the message into a specified folder
Pipe to a program - sends the incoming message to a program you have specified
10. Click Create to initialize the filter.
TESTING A CUSTOM FILTER:
If you have a filter created, you can test it by:
1. From cPanel, in the Mail section, click Account Level Filtering or User Level Filtering.
2. For a user level filter, click Manage Filters next to the email address you'd like to test.
3. In the Filter Test text box, type a test email message and click Test Filter. (Be sure to include the characters or words that you have set your filter to catch).
4. When the test is run, the next screen should display the results. This screen summarizes the actions taken by the filter. It is important to read over the data to ensure that the filter produces the desired result.
IMPORTANT NOTE: We strongly recommend using multiple, simple filters instead of a single, monolithic filter. Exim, your server's mail transfer agent, handles many small rules much more efficiently than it handles a single large rule.
Exim has an implicit limit on how large an error message can be. Excessively large filters can exceed that limit whenever an error is encountered, making debugging impossible.