Knowledge Base

How To Setup Spam Filter Rules

What is a Spam filter?

A Spam filter is an email filter that specifically scans incoming emails for Spam or unsolicited messages. It filters out Spam by automatically deleting them or putting them in a specific folder, which can be emptied by account holders, or set to automatically empty itself, at a later time.


What is a Blacklist and Whitelist Filter?

A blacklist filter is a feature of SpamAssassin that gives users the option to create a list of email addresses that they want blocked. A whitelist filter, on the other hand, is a list of email addresses that are exemptions to the Spam filter rules.


What is a Bayes Filter?

A Bayes (or Bayesian) filter is a technique of scanning the entire content, not just the headers and subject lines, of email messages in identifying Spam. In a Bayes filter, scanned content is compared to a set of parameters or rules set in the email filter rules.

This technique was patterned after Baye's Theorem, which was proposed by English mathematician Thomas Bayes.


How To Setup Spam Filter Rules

There are various ways you can set Spam filters. Below are the ways you can do this.

Apache SpamAssassin is a Spam filter that has an auto-delete option. To enable the auto-delete feature of SpamAssasin, follow the steps below:

  1. Click Sign Up / Log In at the top of this page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password, then click Log In.
  4. On the Home page, click Email or the [ v ] arrow symbol on the right.
  5. Click the Apache SpamAssassin icon.
  6. Next, under Filters, set the Score at which you want incoming emails marked as Spam to be automatically deleted.

    IMPORTANT: It is highly recommended that the Score be set higher than 5 so legitimate messages are not accidentally flagged as Spam.

  7. Click Auto-Delete Spam.
  8. Next page, you will get the confirmation statement: Messages with a Spam score of “(score you selected)” or higher will now be automatically deleted.

IMPORTANT: You can also choose to disable the Auto-Delete feature by going to the Apache SpamAssassin page. Under Filters, click Disable Auto-Delete Spam.


You can also set up a blacklist and/or whitelist filter in SpamAssassin. To set up a blacklist and/or whitelist filter, follow the steps below:

  1. Click Sign Up / Log In at the top of this page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password, then click Log In.
  4. On the Home page, click Email or the [ v ] arrow symbol on the right.
  5. Click the Apache SpamAssassin icon.
  6. Next, scroll down to the bottom of the page and click Configure Apache SpamAssassin.
  7. Next page, you can type in the email addresses you want blocked in the blacklist_from fields and those you want exempted in the whitelist_from fields.

    You also need to fill out the following boxes:
    required_score this is the number of hits an email must get before it will be flagged as Spam. The default setting is 5, which is considered rigid. If you want the scoring to be a little moderate, you should set a higher value, like 8 or 10.
    score this is the score or the number of points assigned for each test that SpamAssassin performs.
  8. Scroll to the bottom of the page and click Save to save your list/s.

IMPORTANT: If only one valid score is listed, then that score is always used for a test. If four valid scores are listed, then the score that is used depends on whether Bayes filter and network tests are enabled in connection to your SpamAssassin.


SpamAssassin uses each score according to the table below:

Score Used Bayes Test Network Test
1st score Disabled Disabled
2nd score Disabled Enabled
3rd score Enabled Disabled
4th score Enabled Enabled

Setting a rule's score to 0 will disable the test.


To further enhance your Email Hosting spam filtering process, you can also create specific email filters in User Filters that will dictate your email system how to handle spam messages. This is basically the Bayes filter for your email account.

If you want to know how to create email filters, click here.

To help you further understand filter rules and criteria when creating email filters, refer to the table below:

  1. Parts of the Email To Be Examined

    These are your options on which part of the email message you want the spam filter to examine and compare with the values or criteria you set in the field below the operators.
    From This is the sender's address.
    Subject This is the message's subject line.
    To This is the recipient's email address.

    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.

    Reply Address This is the address at which the sender receives replies.
    Body This is the main content or body of the email.
    Any Header This refers to any part of the message's header.
    Any Recipient This refers to any recipient of the message.
    Has not been previously delivered This means that the system only examines messages that remain in the queue for delivery.
    is an Error Message This means the system only examines error messages that an auto-response system sends.
    List ID This refers to the account's mailing lists.
    Spam Status This is whether Apache SpamAssassin marked the message as spam or not. The Spam Status line begins with Yes or No.
    Spam Bar This is the content of the Spam Bar header that Apache SpamAssassin generated for this message. The more plus signs (+) that Apache SpamAssassin assigns to a message, the greater the likelihood that the system marks the message as spam.
    Spam Score This is the total number of plus signs (+) in the Spam Bar value, expressed as an integer.


    These options will determine what type of comparison you want the Spam filter to perform.
    equals The message exactly matches a defined string.
    matches regex The message matches a regular expression that you define.

    NOTE: The filter text box accepts regular expressions when you select this option, rather than more commonly-used wildcard characters (for example, * or ?).

    contains The message, a string that you define.
    does not contain The message does not contain the defined string.
    begins with The message begins with the defined string.
    ends with The message ends with the defined string.
    does not begin The message does not begin with the defined string.
    does not end with The message does not end with the defined string.
    does not match The message does not exactly match the defined string.


    This is the field where you type in the characters, text, or other variables that the spam filter will look out for in the incoming email messages, according to the specifications you set in the two text boxes above.


    This is where you specify the outcome or consequence that will be applied to the conditions you have set in Rules.
    Discard Message The system discards the incoming message with no failure notice.
    Redirect to email The system forwards the message to another email address that you specify.
    Fail with message The system discards the message and automatically sends a failure notice to the sender.
    Stop Processing Rules The system skips all filter rules.
    Deliver to folder The system delivers the message to a specified folder.
    Pipe to a program The system sends the incoming message to a specified program. For more information, read the Pipe to a Program section below.

Congratulations, you have now successfully set up your Spam filter rules.

Did you find this article helpful?

* Your feedback is too short