Knowledgebase:
How To Set Up Email Filtering With SpamAssassin
Posted by Daniel Naval on 11 May 2019 04:26 PM

First, you need to Login to your cPanel account.

To set up an email filtering with SpamAssassin in cPanel. You will need to create a Spam folder within your webmail.

Locate and click on Email Accounts under Email section.

 

 

You will be redirected to the Email Accounts page, then just select the email account you wanted to create Spam folder and click Access Webmail.

 

 

Choose which email clients you wish to use from the 3 as seen on the image below.

 

 

Once the email account is opened, click on Settings from the upper right corner of the page.

 

 

You will be redirected to the Settings page, select the Folders tab and click on the plus (+) sign at the bottom of the page.

 

 

A windows will show up asking the Folder name (Named as Spam) then just click on Save.

 

 

Once done, you will see the Spam folder from the main page of your webmail.

 

 

Now, to set up the Email Filters go back to the Email section and click on Email Filters.

 

 

You will be redirected to the Email Filters page. From there, click on Manage Filters and proceed to Create a New Filter.

 

On the Create a New Filter page, you will be asked to enter a Filter name. You can enter your preferred filter name. For example, “Test Rule”. Then on the Rules section, there are 2 drop down menus where you can set up the rules for filtering.

 

First drop down menu:
From – sender’s email address
Subject – subject of the message
To – email address where the message will be sent
Reply – email address where the sender receives replies
Body – email message content
Any Header – any part of the email message’s header
Any recipient – any recipient of the email message
Has Not Been Previously Delivered – email messages that remained  in the queue for delivery that will be checked by the system
Is an Error Message – error messages that an auto-response system sends
List ID – account’s mailing list
Spam Status – status of the marked message if spam or not and spam status line starts with Yes or No
Spam Bar – 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 – total number of plus signs (+) in the Spam Bar value, expressed as an integer

 

Second drop down menu:
equals – messages that exactly matches a defined string
matches regex – messages that matches a regular expression that you define
contains – message that contains a string that you define
does not contain – messages that does not contain the defined string
begins with – messages that begins with the defined string
ends with – messages that ends with the defined string
does not begin – messages that does not begin with the defined string
does not end with – messages that does not end with the defined string
does not match – messages that does not exactly match the defined string

 

After you have configured the settings you wish to use, you may proceed with the Actions drop down menu. This is the options on what to do with the emails that has been filtered. Once done, click on the Create button to finally set up the email filter.

 

 

You will then see a message that the filter has been created successfully.

 

 

Click the Go Back button for you to be redirected back on the email account’s filter page. You will see the current filters that has been configured.