Search The Hostwinds Guides Knowledge Base

How To Create A SPAM Filter in cPanel

Share This Article

Hostwinds clients who are using cPanel and have a web hosting package with Apache SpamAssasin SPAM Filters enabled will be happy to make use of this feature to help deal with SPAM emails from being received. In this guide, we will cover how to set up SPAM filters and use these on your cPanel account and is targeted towards Hostwinds Shared, Business and Reseller clients. In order to continue with this guide, please login to cPanel.

 

How To Create SPAM Filter

Step One: Navigate to the email section and select Spam Filters

 

cpanel spam filters

 

Step Two: Check whether Apache SpamAssassin is enabled. If it is not, click Enable Apache SpamAssassin by using the toggle switch to turn it on (turn on spam filters). You can confirm the settings by viewing the message below the on/off toggle switch to confirm if this is turned on or off and should read something similar to this:

Apache SpamAssassin is enabled. This will mark suspicious email messages as spam. The server will update the header of new messages whose calculated spam score exceeds the Spam Threshold Score (5).

Step Three: Navigate back to cPanel’s Global Email Filters interface from the cPanel Home Page as shown below:

 

cpanel global email filters

 

Step Four: Click Create a New Filter button (create global filter) to create a new filter

Step Five: Enter the name of your filter in the Filter Name text box, such as SPAM Filter or any name that you will easily remember

Step Six: Select Spam Bar from the first menu in the Rules section

Step Seven: Select contains from the second menu in the Rules section.

Step Eight: Enter the spam score in the text box. Represent the desired spam score with plus (+) characters.

For the purposes of this guide, to filter all of the mail to which Apache SpamAssassin has assigned a spam score of five or higher, enter +++++ in the text box.

Step Nine: Apache SpamAssassin examines every email message for spam characteristics, and then assigns it an overall score based on the number of spam-related traits found within the message. We do not suggest editing the Spam Score unless you have a specific need to do so. This may lead to unintended consequences

Step Ten: The spam score is counter intuitive, so the lower the spam score, the more aggressive the spam filter will be. A spam score of 1 for example is much more aggressive than a spam score of 5 so it is important to monitor the messages that are being marked as spam for any false positives. A spam score of 10 should allow most email to not be marked as spam although the results may vary and it is important to monitor this closely to ensure any emails you need to receive are not being marked as spam

Step Eleven: Select Deliver to folder from the menu in the Actions section

Step Twelve: Click the Browse button to select the folder to which you wish to send your spam email and to see a list of all available folders

Step Thirteen: Click Create to create, save, and activate the spam filter. This should end up looking similar to the following screenshot:

 

spam filter cpanel spamassasin

 

Change SPAM Threshold Score

Step One: Navigate back to the Span Filters are in the Email section of cPanel

 

edit spam score threshold

 

Step Two: Click on the Spam Threshold Score link

 

change spam threshold score

 

Step Three: Select the new score from the drop down menu. The lower the number you select, the more aggressive the filter will be at scoring email as spam

Step Four: Click the Update Scoring Options button to update this setting

 

[notification type=”alert-info” close=”false” ]Spam messages score higher calculated spam scores than regular messages. If a message’s calculated spam score meets or exceeds the Spam Threshold Score, the system will label that message as spam. For example, an account that uses a Spam Threshold Score of 10 will only mark messages that are obviously spam. A Spam Threshold Score of 2 will label many messages as spam, which includes messages that are likely not spam. We recommend that new users use the default setting of 5. We recommend that an ISP set this score to 8. The Spam Threshold Score does not affect the Auto-Delete Threshold Score.[/notification]

 

Edit Global Filters

Step One: If you are happy with the results and are seeing this feature only mark spam emails and do not see any false positives, or if you change the score as shown above, you will want to go to the Global Email Filters again in the Email section

 

edit global email filters

 

Step Two: Click on the Edit button to the right of the filter that you have created. In this example, the filter name we have created is named SPAM Filter

 

edit global filter

Step Four: Edit any of the settings in this area.

If you have lowered your spam score from five to four for example, you would want to modify the +++++ to show ++++

If you would like to auto delete these messages, you can select Discard Message from the drop down menu

 

Delete SPAM emails

It is important to monitor the size of your spam folder so that your account remains in good standing. We also suggest to make sure you have a backup of your email before deleting any email from the server in case these need to be restored.

Step One: First, you will want to go your Email Accounts in the Email section of cPanel.

 

email accounts

 

Step Two: The Default Email Account should look similar to the below and contains the username for your cPanel/FTP account

Step Three: Login to webmail for your account by clicking on the Access Webmail link

 

access webmail to delete spam

Step Four: Choose from the available webmail clients. In this example, we will use Roundcube

Step Five: Find the folder that you are sending any email marked as spam to with the Global Filter that we had set up previously in this guide. For the purposes of this guide, this is where the ./Junk mail folder resides from our spam filter we created previously in this guide

 

roundcube junk folder

Step Six: Use your mouse to select one of the images and use SHIFT + Left Click with your mouse to highlight all of the messages in your Junk folder

Step Seven: Use this same method to navigate to the Trash folder and remove any Junk Email so that these spam emails are complete removed from the server and do not count towards your disk space usage or inode usage as this may build up over time if you receive many spam emails

 

Related Articles

Related Resources