Managing Spam Filtering with Spam Assassin, Blacklist, Whitelist, Account Filters, and User Filters

This Article Includes: Using Spam Assassin, Account Filters, User Filters, Blacklist, and Whitelist.

The First Step is to log in to your cPanel Control Panel. You should be able to log in at: http://www.Your_Domain.com:2083 (where Your_Domain.com is your actual Domain).

Managing Spam Filtering:

Your cPanel Server uses the Popular “Spam Assassin” Spam Filtering Software.

SpamAssassin is an email utility that attempts to filter spam by examining incoming email and testing for spam characteristics. It uses Bayesian spam filtering and network testing to screen incoming email. This results in an overall score. If an incoming message reaches a predefined score, the message is discarded.

After Logging Into your Control Panel, Click on the “Spam Assassin” Icon.   From This Section you can Manage all aspects of the Spam Filtering options, Including White Listing and Blacklisting.

Enable SpamAssassin

To enable SpamAssassin:

* Click the Enable SpamAssassin button on the SpamAssassin home screen.

Note: It is possible to disable SpamAssassin by returning to the SpamAssassin page and clicking Disable SpamAssassin.

Automatically Delete Spam

This function automatically deletes messages that meet or exceed the score limit. Activate this function by clicking the Auto-Delete Spam button under the Filters heading.

Click the Disable Auto-Delete Spam button to disable this feature.

Note: Enabling this feature could cause you to lose email that is not spam if a message meets or exceeds the defined score. Make sure SpamAssassin is configured properly for your account before using this feature.

Enable the Spam Box

Enabling the spam box will create an additional folder, named spam, where spam mail will be sent. This can be useful in preserving mail that may have mistakenly been filtered by SpamAssassin. It is recommended that you enable this feature.

This feature also comes with a Clear Spam Box function that will delete the messages in the spam box.

It is possible to disable the spam box by returning to the SpamAssassin page and clicking Disable Spam Box.

ALERT! Warning: If you check your mail via a POP3 client, you must access and empty your spam box using the username youraddress@example.com/spam and your email account password. Otherwise, spam may accumulate in the spam box and cause you to reach your email account quota.

* Only the spam box may be accessed using the above address format; no other folders on your account are accessible in this way.
* While this is not an issue for IMAP and webmail users, all users should periodically check and delete the contents of the spam box.
* If you are unsure whether you use POP3 or IMAP to receive mail, you may be able to find this information on your email application’s Preferences screen.

Configure SpamAssassin

When you click Configure SpamAssassin, you can add email addresses that should be filtered automatically by typing the address into the blacklist_from box. A whitelist can be created in the same way at the bottom of the page. It is also possible to specify scores that SpamAssassin should use for each particular test.

Set Required Spam Score

SpamAssassin examines every email message for spam characteristics, then assigns it an overall score. Enter the score required for a message to be considered spam.

5.0 is the default setting and is aggressive. It would be suitable for a single user, but an ISP should set the default to be more lenient (8.0 or 10.0).


Add Addresses to the Blacklist:

Enter addresses whose email is often allowed past the spam filter, but from whom you do not wish to receive email.

You may use * as a wildcard for multiple characters, or ? as a single-character wildcard.

* user@example.com ” Blacklists a single email address.
* *@example.com ” Blacklists all the addresses at example.com.
* ?ser@example.com ” For example, User@example.com would be blacklisted, but AUser@example.com would not be blacklisted.

By default, 5 text boxes appear, allowing you to add 5 addresses. To add more than 5 addresses:

1. Fill in the first 5 text boxes.
2. Click Save.

When you return to the page, more textboxes will appear.

Add Addresses to the Whitelist:

Enter addresses whose email is often blocked, but from whom you wish to receive email.

You may use * as a wildcard for multiple characters, or ? as a single-character wildcard.

* user@example.com Whitelists a single email address.
* *@example.com Whitelists all the email addresses at example.com.
* ?ser@example.com For example, User@example.com would be added to the whitelist while a User@example.com would not be added.

By default, 5 text boxes appear, allowing you to add 5 addresses. To add more than 5 addresses:

1. Fill in the first 5 text boxes.
2. Click Save.

When you return to the page, more textboxes will appear.

PICK Remember:

* Click Save to store the configuration changes.
* A whitelisted address is automatically allowed past the filter.
* A blacklisted address will automatically be filtered by SpamAssassin.
* More details about configuring SpamAssassin can be found at http://spamassassin.apache.org/.

Account Level Filters:

Best Practices

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.



Add an Account Level Filter

It is important to give the filter an appropriate name, as it will make the task of managing existing filters easier in the future.

To create a new filter:

#1. Click Create a new Filter.

#2. Type a name for the filter in the Filter Name box.

#3. Select a message characteristic from the first pull-down menu.

#4. Select an operator from the next pull-down menu.

#5. Enter the characters or words you wish to use as a filter.
Note: This field will accept regular expressions (when you select the matches regex operator), rather than more commonly used wildcard characters (such as * or ?).

#6. You can add and subtract rules by clicking the + and – buttons.

#7. Select an action from the pull-down menu under the Actions heading. You can add and subtract actions by clicking the + and – buttons.

#8. Click Activate to initialize the filter.

User Level Filters:

Best Practices

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.

Add a User Level Filter

It is important to give the filter an appropriate name, as it will make the task of managing existing filters easier in the future.

To create a new filter:

#1. Click Create a new Filter.

#2. Type a name for the filter in the Filter Name box.

#3. Select a message characteristic (from, subject, to, etc.) from the first pull-down menu.

#4. Select an operator (equals, contains, etc.) from the next pull-down menu.

#5. Enter the characters or words you wish to use as a filter.
* note Note: This field will accept regular expressions (when you select the matches regex operator), rather than more commonly used wildcard characters (such as * or ?).

#6. You can add and subtract rules by clicking the + and – buttons.

#7. Select an action from the pull-down menu under the Actions heading. You can add and subtract actions by clicking the + and – buttons.

#8. Click Activate to initialize the filter.

cPanel offers a comprehensive list of options available to configure your filter.

PICK A word about operators: When you create a filter using several operators, it may be useful to note that cPanel will always process the “and” operator before the “or” operator. As a result, email filters will be processed as follows:

* A or B and C will be processed as A or (B and C).
* A and B or C will be processed as (A and B) or C.

If you wish to create a filter such as (A or B) and (C or D), you would have to create it like so:

* (A and C) or (A and D) or (B and C) or (B and D).

Test a Custom Filter

Once a filter has been created, it can be tested.

To test your filter:

#1. Type a test email message in the text box below the Filter Test heading.
* Be sure to include the characters or words that you have set your filter to catch.
#2. Click Test Filter. 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.

To edit an existing filter:

#1. Click Edit next to the appropriate filter name.

#2. You can adjust any of the fields displayed, the message characteristic, operator, term to filter, or resulting action.

#3. Click Activate to initialize the filter.