Web Hosting / cPanel

How to Configure the Best CPanel SpamAssassin Settings

Jan 04, 2023
10 min read
SpamAssassin Settings

If you are having problems with email spam, whether it be the occasional promotional mail, or 100’s or even thousands of emails spamming your inbox each hour, Email Spam Protection can help.

SpamAssassin is an open-source Apache Project located in cPanel under the Spam Filter settings. The source was first made widely available in April 2001. If you are more technically-minded and want to see how it has evolved over the years, you can see a full change history here.

It works by using a variety of spam detection methods, including:

These spam detection methods are applied to email headers (an excellent guide to finding email headers) and content to classify the email using various statistical methods. They are designed to block unwanted email messages before they reach your inbox and evolve to combat the changing ways spammers get to your inbox.

It is a far cry from the keyword-based spam detection systems used prior.

I will first go through a short cPanel tutorial showing how to enable the Spam Filter and then go through the different SpamAssassin configuration options.

How to Enable the SpamAssassin Spam Filter in cPanel

At this stage, all you have done is enable the Spam Filter. When you receive emails, messages with a score of 5 (default score) will be marked as spam.

If the email is found to be spam, the word ***SPAM*** will appear at the start of the subject field, as shown in the screenshot:

Marked as spam.

Unless you configure SpamAssassin to auto-delete or move the spam to the junk folder (I’ll cover how to do this shortly), No other actions will occur, and the message will remain in your inbox.

How to Configure the SpamAssassin Score Setting

An email message spam score is calculated on a scale of 1 to 10. The higher the SpamAssassin Score, the more likely it is to be spam. If a message’s calculated spam score meets or exceeds the Spam Threshold Score, the system will label that message as spam.

The Spam Threshold Score and Auto-Delete Threshold Score (I’ll cover this shortly) are different and, as such, do not affect each other.

How to Configure SpamAssassin to Move Spam to Junk Folder (Spam Box)

When Apache SpamAssassin is enabled, you may want to move spam to a different folder. This option will automatically move any message above the Spam Threshold Score into the “Spam” folder. You can then review the spam messages and adjust the Spam Threshold Score to fine-tune them.

How to Configure SpamAssassin Auto-delete

No email filtering system is 100 percent perfect (you can read an interesting discussion on the StackExchange about that here).

While spam filters try to catch all spam emails, Spammers are continually adapting to create emails that are trusted not to be spam by automatic filters and humans themselves. Spammers try to make emails that can bypass the filters, looks legitimate, it is opened, and look attractive enough so that a user clicks a link in the mail. It is a continuous battle.

As a result of the imperfection of email filters, I recommend that you do not use the auto-delete option unless you have to.

If you have a particular problem with email spam, you can set the auto-delete score to be higher than the spam score. This way, you can still set the spam filter to be quite strict and only delete the worst spam.

Additional Configurations (For Advanced Users)

Here, you can configure the following settings:

  • Whitelist emails
  • Blacklist Emails
  • Calculated Spam Score settings

I’ll go through each of these settings in turn:

How to Configure the SpamAssassin Whitelist

If you have an important client or friend or want to ensure you will receive a specific sender’s email, you need to whitelist their domain.

How to Configure the SpamAssassin Blacklist

If you get repeated spam from any particular email address, such as a mailing list you cannot unsubscribe from, you can blacklist that domain.

How to customize the Calculated Spam Score settings (Advanced Users Only)

This is where you can configure different scores for the hundreds of different tests and assign a score to that test. For example, you can check popular spam email lists and set a “10” score to the Calculated Spam Score to ensure your Spam Filter always catches any email caught by that test.

I do not recommend you change any of these settings, but I will walk you through a couple that you may wish to consider if you have a particularly bad problem with spam.