SpamAssassin

Introduction

    This is just a page about what I like to do about spam.  I use SpamAssassin to remove spam from my incoming email.  There are ways you can tweak SpamAssassin, and I'm going to show you also how to use it with KMail on Linux.
    NOTE: this page is old.  Your mileage may vary.

Installing SpamAssassin

    You can find the instructions for installing SpamAssassin on their website.  Usually perl's CPAN system is used.  Me, I read through the list of required and recommended features and use CPAN to install all of those, then install SpamAssassin after everything else is installed.

Tweaking the rules

    When you get it installed, you should get a ~/.spamassassin/ folder.  You can tweak certain rules using the user_prefs file in that directory.
    Rules work like this: they are basically a matching rule.  As SpamAssassin looks at the email to see whether it is spam, the rules are basically a test.  Say there's a rule that matches if it's an HTML email.  If it matches, the score for that rule is added to the email's spam score.  If the score goes above a total, then the email is considered spam.  The default total is 5 or higher to be considered spam.  If there are, for example, three rules that matched, and they are all scored a "1", then that would be a total score of 3, and the email would not be considered spam.
    In the user_prefs file, you can alter (adjust) the score for any rule.  All you need to do is add an entry for it.  Say you wanted to change the score for HTML_MESSAGE rule: you'd add a line "score HTML_MESSAGE 3" to the user_prefs file if you wanted that rule to be scored a 3.
    If this is all too much for you, remember that SpamAssassin is constantly being improved and adjusted to make sure that the majority of spam is filtered out.  So when you install SpamAssassin, the rules in the link above get the default score you see on that page.  You don't really have to adjust anything yet: normally SpamAssassin without any options tends to work just fine.
    If you'd like, you can see my custom rules here.

Adding KMail Filters

    Ok, now we want to do some filtering.  If you use KMail for your email program, you only have to add the following filters.  Click any of the images below to view the fulls-ze image.  First, there's the rule that tells KMail to send ALL incoming email through the SpamAssassin filtering program to get tested:
Filter #1
Then there's the next filter that checks to see if it was flagged as spam.  If it was, it needs to go to the trash folder (or if you want you can add a "spam" folder and then edit this rule to send it there):

Filter #2
Then there's a last filter that's optional: to report something as spam.  You don't have to use this filter.

Filter #3
Then lastly, if you want to add the ability to un-filter something that gets accidentally flagged as spam, you can add this filter:
Filter #4
As you can see, it's not that hard to get SpamAssassin working in KMail.

Conclusion

    Getting SpamAssassin installed, configured, and working with KMail isn't that hard at all.  Have fun!