Spam filtering with Kmail

Jack Wallen
Oct 16, 2009
Updated • Feb 13, 2018
Email
|
3

SPAM. It's a dreadful word that causes many a computer user to yank out their hair and wish their service provider would do a better job of keeping SPAM out of your inbox. But that is not going to happen over night. So...it is up to the end user to make sure they have extra means of SPAM prevention rolled into their email clients.

Most email clients contain some sort of SPAM prevention. On the Linux operating system you can employ such tools as Bogofilter or Spamassassin. Either of these tools are great for stopping SPAM - but what about using them with your favorite email client? With some Linux email clients you have to add extra applications in order to have one of these SPAM filters doing their job with your client. Some clients, however, have built-in tools to save you a little work. KMail belongs to the latter category. So long as you have either/or Bogofilter or Spamassassin installed, you are one step closer to having solid SPAM filtering.

In this article you will learn how to set up reliable SPAM filtering in the KMail mail client.

Bogofilter and Spamassassin

KMail can use either Bogofilter or Spammassassin easily. Read up on either tool and decide which application you want to use. I have had good luck with both, but I do believe Bogofilter is easier to set up. And since KMail will automatically detect either, the choice is yours.

You can install either tool from within the Add/Remove Software utility by following these steps:

  1. Open Add/Remove Software utility.
  2. Search for either "bogofilter" or "spamassassin" (No quotes).
  3. Select either (or both) tools for installation.
  4. Click Apply to install.

That's it. Now you are ready to move on to KMail.

Kmail SPAM Wizard

Figure 1
Figure 1

When you have KMail set up and running click on the Tools menu and select the "Anti-SPAM Wizard" entry. When the Wizard opens the first thing it will do is detect which SPAM tools you have installed (see Figure 1).

Once the wizard has detected your SPAM tools, select the tool you want to use and click Next. For the purpose of this article I will select Bogofilter.

The next step in the wizard will ask you for two configurations:

  • Mark detected SPAM as read: I prefer to unset this, because of the next configuration option.
  • Which folder to relocate SPAM: By default KMail will move SPAM to the trash folder. I prefer to create a new SPAM folder in order to catch any false-positives.

By moving SPAM to a specific SPAM folder (and not the trash folder) and keeping SPAM unread, you are less likely to miss any email mistakenly marked as SPAM (false-positive).

The final window of the wizard gives you a report on what you have set up. In my case the wizard creates the following filters:

  • Bogofilter Check
  • Spam handling
  • Classify as Spam
  • Classify as NOT Spam

Click the Finish button and your KMail client is ready to learn. And learning is the key.

Help Bogofilter learn

Figure 2
Figure 2

Before Bogofilter can become a reliable SPAM filter, it has to learn what should be classified as SPAM and what should be classified as HAM. Here's how I like to do it. Allow plenty of email to collect in your inbox. As the mail comes in take all SPAM (that is not already marked and moved) and move it to the SPAM folder. Once you have cleared your Inbox of all SPAM, select all mail in that folder and then click the Ham button (see Figure 2).

Now, once you have collect a good amount of SPAM in your SPAM folder open that folder up, select all the SPAM, and click the SPAM button.

You may have to do this trick a few times before Bogofilter has been properly trained. You will know when Bogofilter has become accurate with your SPAM/HAM.

Final thoughts

It couldn't be much easier to catch and mark SPAM with KMail and Bogofilter. But if you find Bogofilter not as reliable as you would like, run the Wizard and try Spamassassin instead.

Summary
Spam filtering with Kmail
Article Name
Spam filtering with Kmail
Description
In this article you will learn how to set up reliable SPAM filtering in the KMail mail client.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. oiaohm said on October 18, 2009 at 11:43 am
    Reply

    Spamassassin can get known bad lists Ishan

  2. Ishan@ILoveFreeSoftware said on October 17, 2009 at 1:18 am
    Reply

    Nice article. Regarding making Bogofilter “learn”, this is killing my enthusiasm about this software. I would love to have something that could be driven from some central internet based engine to know what is spam, and what is not. This would ensure that if some mails have already been classified as spam by some other user, I don’t have to do the same.

    1. jorge getson said on February 21, 2010 at 6:04 pm
      Reply

      That would be nice but if I get an email from Obama@obamaaintmymama.gov and classify it as spam and then it is included at the so called Internet Spam site, then you probably would be unhappy about not getting email from your favorite Communist.
      Then you would want a list that conforms to your wishes verses mine.
      I would agree.
      That is why I make my list instead of depending on someone else’s concept of what is spam.
      The internet site could include known large bulk spam sites and very notorious sites but I believe some of those already exist.
      Black lists etc.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.