Apache SpamAssassin™ – Spam shall not pass!

Greetings! I think each of us has faced a spam issue at some point. To help combat the problem, many people create separate “personal” mailboxes which are used only for personal messaging, and then they create another “registration” mailbox that is used for registering with different internet services. Why should we suffer?spam Isn’t there a better way?

We think so! When you host with GlowHost, your website control panel includes an extremely flexible solution, called Apache SpamAssassin™ – Let’s review some basic and additional features. 

SpamAssassin scores.

SpamAssassin™ (SA) analyzes each message using its own patterns and if one of the patterns match – it is a red flag. Each red flag means some spam scores will be given to the message. For example, first an e-mail arrives on the server. SA scans that email and finds links to an IP address inside of that email. Since finding an IP address in an email often is a pattern found in spam messages, SA considers it as a red flag, and gives that message some number of spam scores (e.g. 2 scores). Let’s assume the message subject also contains some suspicious keywords and sounds like “Find out how to earn money!” or “Blue Pills” SA will add more scores because of that subject (e.g. 1.7 scores). As a result, in total the message gets 3.7 Spam scores (or points, or hits, as you prefer to call them).

If you would like to get premium spam filtering services, you should know that GlowHost now has the option of adding SpamExperts to your hosting solution. Having SpamExperts means that your email will be sanitized and over 99% of recognized incoming spam will be quarantined. There is even the benefit of added security! SpamExperts anti-virus protection helps prevent viruses from entering your systems as well. You can find more information and order it here.

You will need to define what score will be the threshold for determining spam messages in your individual case. By default, it is 5. We suggest to keep this score at the default of 5, and see how it goes.

If too many spam messages are accidentally determined to be “Ham” (meaning, “not spam” or “good emails”) you can set the score threshold to be lower. Otherwise, if too many legit emails are marked as spam, you can raise the score threshold. It is a common mistake for users to reverse these. Please be careful here.

Now that we’ve flagged the messages as spam, what to do with spam messages? You have several options here and can configure SpamAssassin to either just delete spam messages or move them to the spam folder. We think that the best way is to combine these two methods.

Moving spam messages to the spam folder.

1. Login to cPanel and click on the “Apache SpamAssassin™” icon in the “Mail” section.

Apache SpamAssassin in cPanel

2. Find the “Spam Box” area and click on “Enable Spam Box” button. That’s it, spam messages will now be delivered to spam folder under your inbox.

Apache SpamAssassin enable spambox

3. As I have already mentioned, the default score is 5, that means that all messages that will get more than 5 SPAM scores will be considered spam and will be sent to the spam folder if you have enabled it. If you would like to change that score, you can do that, just click on “Configure Apache SpamAssassin™” and set the new “Required score”. That’s all.

Configure SpamAssassinSpamAssassin score

Auto-delete spam messages.

As I have mentioned and you probably noticed, there is the possibility to automatically remove spam messages. This option is called “Spam Auto-Delete.” You can enable it right in the SpamAssasin main page. Just set the score and click on “Auto-delete Spam.”

SpamAssassin auto-delete function

We suggest enabling this function only for emails that contain high spam scores, like 8-9, then slowing working your way to lower numbers as you feel comfortable with it. This way, SpamAssassin will remove all obvious spam messages, and others will remain in the spam folder. If one of your “not spam” emails went to the spam folder by accident, (a false-positive) you will be able to restore it by simply moving it back into your inbox. False positives can occur on legitimate emails when the emails contain payment links to internal systems, dollar signs, IP addresses, email addresses, usernames, passwords and etc.

I should note that even if you don’t enable the auto-delete function or spam folder, SpamAssassin will still mark messages tagged as spam with “*** SPAM ***” in the subject line of the email that you will receive. For example, if you get a message with 7 scores, the subject might look like:

“*** SPAM *** Blue Pills make it bigger!”

If you use mail software like Thunderbird, You can set up filters to look for the pattern “*** SPAM ***” in the subject and can define in which folder these types of emails will be automatically deposited into, such as a folder called “spam” or “junk.”

Junk emails will also have a line like the one below in the email’s headers. This line can also be used to create filters.

X-Spam-Bar: +++++++

Email headers are usually hidden by default, so you will need to enable them if you wish to see what I am talking about. They can remain disabled once you have set up your filter and tested that it is working.

One method to consider is to create several filters that will check for the X-Spam-Bar parameter and route the emails to different folders according to its spam score. For example, you might setup 10 different folders and route all emails that have “+” into the first folder, all emails that score “++” into the second folder, all “+++” go in the 3rd folder and so on. You are more likely to find more false positive emails, (the ham that got marked as spam) in the folders that capture emails with the lowest scores like those that have “+” or “++” in them as compared to the folder that captures “++++++++++.” You might check the “+” folder daily, and the “++++++++++” folder once a month or every couple of weeks. This is a super cautious approach but a good one for learning how SpamAssassin works and for getting comfortable with your own personal SpamAssassin settings.

That is all! Hope it helps. Also, you can find more information about training SpamAssassin here.

Leave a Reply