Example: Using Multiple Email Filters with SpamAssassin

I have created a very detailed SpamAssassin tutorial which goes in detail all the steps required to configure SpamAssassin to create a spam filter properly. It includes how to set the SpamAssassin Score (Spam Threshold Score), move spam to junk folder (Spam Box), auto-delete, and add emails to either the whitelist or blacklist.

When you create rules within the Spam Filters section, it will automatically create Global Email Filters. It can be easier to configure basic SpamAssassin rules through this interface.

There are times when you want more granular control over when SpamAssassin triggers an action. For example, you may want random newsletters you receive to be marked as spam unless the body matches “keyword”. This may be a particular topic you are interested in.

I will now make a SpamAssassin rule that satisfies the following conditions:

  • Spam Score is less than 4.
  • The body does not contain the keyword “SEO”.

Step 1: Go to the Filters menu

  • Click on the “Email Filters” or “Global Email Filters” icon on the cPanel dashboard.
    01

 

Step 2: Create a new Email Filter

On this page, you will see a list of your current email filters. You will also be able to create a new filter for that email account.

  • Click the “Create a New Filter” button to create the new filter.
    02

 

Step 3: Enter the following settings

Enter the following settings:

  • Filter Name: Delete Spam with score 4 or below that does not contain SEO in body
  • Rule 1: “Spam Bar” “contains” “++++” AND
  • Rule 2: “Body” “does not contain” “SEO” AND
  • Rule 3: “Body” “does not contain” “seo”
  • Actions: Discard Message

03