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:
That's it. Now you are ready to move on to KMail.
Kmail SPAM Wizard
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:
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:
Click the Finish button and your KMail client is ready to learn. And learning is the key.
Help Bogofilter learn
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.
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.Advertisement
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.