Software

How do I ... enable Spambayes's filtering in Thunderbird for Windows?

Spambayes is a Bayesian spam filtering system, which classifies junk mail into three classifications. Jack Wallen describes how to install and configure Spambayes into Thunderbird.

The Thunderbird e-mail client is an outstanding piece of cross-platform, open-source software. But one area where Thunderbird can use a little improvement is its Spam protection. Yes, by default, Thunderbird does have internal Spam protection, but I have found that protection to be less than stellar.

Enter Spambayes. Spambayes is a Bayesian spam filtering system written in Python. Spambayes classifies junk mail into three classifications: Spam, Ham, and Unsure. Spam is the obvious junk e-mail. Ham is non-Spam e-mail (not junk). Unsure is e-mail that you are not sure about. So instead of a lesser "on/off" system, you have an "on/pending/off" system. It's actually more complex than that (making use of both Spam and Ham scores for each message), but you get the idea.

So it sounds like enabling a Spambayes filter for the Thunderbird mail client would be a difficult task. Not at all, thanks to the Thunderbayes extension. Thunderbayes adds a toolbar button to the Thunderbird client that allows the user to mark each message (to help the Bayesian system learn) as either Spam or Ham.

This blog post is also available in PDF format in a TechRepublic download.

Getting and installing

Installing Thunderbayes is just like installing any extension for Thunderbird. In the Thunderbird client, click on the Tools menu and select Add-ons. In case you have never installed an extension with Thunderbird (it's a bit different than Firefox), I will walk you through the process.

In the Add-ons window (Figure A), click on the Get Extensions link near the bottom right. This will open up Firefox (or a new tab if Firefox is already running) to the Thunderbird extensions page. Enter Thunderbayes in the search field and hit the Enter key.

Figure A

As you can see, Thunderbayes is already installed.

Once you are on the Thunderbayes page, you do not want to click the Download button. Instead you want to right-click and select Save Link As and save the file to a location such as your Desktop. Once you have saved the file, go back to the Add-ons window and click the Install button. This will open a new window and ask you to locate the target extension. Find the Thunderbayes extension, select it, and click Open. Once it is installed, you will be required to restart Thunderbird.

Now notice there is no toolbar icon for Thunderbayes. This is because you are going to have to add the icon manually. Click on the View menu and then the Toolbars sub-menu. Select Customize. When the toolbar customization window is open (Figure B), click and drag the Spam icon to the toolbar (you can place it where you like), and then click OK. You are almost set.

Figure B

You will have to scroll down to locate this icon.

Configuration

The final setup is to enable Thunderbayes for an e-mail account. To do this, click on the Tools menu and select the Account Settings entry. As you can see in Figure C, Thunderbayes will be available for each e-mail account configured in Thunderbird.

Figure C

Make sure you enable Thunderbayes for all e-mail accounts.

Another important configuration is to create a Junk folder where Thunderbayes can place suspected Spam, unless you just want to have the e-mail automatically deleted. As you can see in Figure C, there are settings you can apply to the account. This is where you tell Thunderbayes what to do with Spam and Unsure messages.

Many people would prefer to have Spam simply deleted and Unsure sent to a Junk folder (where the mail can be sifted through). This is probably the smartest route to keep you from losing critical e-mail to a false-positive check. To do this, you will first need to create a Junk (or Unsure) folder for your account by right-clicking the Local Folders in the left pane and clicking New Folder. Name this folder whatever you prefer and make sure it is located in the Local Folders directory.

Now that you have created a folder where Unsure messages can be placed, go back to the Account Settings and click the Filter Spam Messages When They Arrive check box. Now click on the Configure button to set up Thunderbayes to automatically delete Spam when it arrives.

Now do the same for Unsure messages, only this time you will have the system automatically move Unsure messages to the Junk folder on Local Folders.

Once you have enabled Thunderbayes, you will want to add the Spam Status column in your message preview pane. You will see in the right-most column in the Preview pane, a small drop-down arrow (Figure D). Click on that arrow and make sure Spam Status is checked.

Figure D

You can disable the built-in Thunderbird spam column if you like.

Once you have enabled the Spam Status column, you will see each e-mail with one of three icons associated with its Spam status: A gray question mark indicates the e-mail did not pass through a SpamBayes proxy and does not have an X-SpamBayes-Classification header. If an e-mail is Spam, it will have a red circle with a slash. If an e-mail is Ham, the indicator will be a gray dot. An Unsure e-mail have a yellow question mark beside it.

Configuration is complete. You are now ready to use Thunderbayes.

Usage

Using Thunderbayes is fairly straightfoward. If an e-mail comes in that is obviously tagged as Spam through a SpamBayes proxy, the Spam will be automatically deleted. If an e-mail does not get tagged, it will arrive in your inbox marked as Ham. If, however, you know that an e-mail is incorrectly marked and is definitely Spam, you simply have to select the message, click the Thunderbayes drop-down list, and mark the message as Spam. The message will automatically be deleted for you (one-upping the Thunderbird built-in Spam system).

Now if you go into your Junk folder (where you have directed Unsure messages), you can mark messages as either Spam or Ham by selecting the message and then choosing the correct type from the Thunderbayes drop-down list in the toolbar. If the messages is marked as Ham, it will automatically be placed back in your inbox. If the message is marked Spam, it will automatically be deleted.

And of course the system does learn as it goes. So once you mark a message as either Spam or Ham, most likely the next time one comes through that matches, it will be handled accordingly.

One small gotcha

Thunderbayes filters messages as they arrive (before they are even placed in any folders), so you might notice a small slowdown in message retrieval time. And there have been some users who, over time, have noticed Thunderbird slowing down exponentially as more words and definitions are added to the Thunderbayes system. This has not been the case on my system (and I do see plenty of Spam -- well, I used to until I started using Thunderbayes).

Final thoughts

Thunderbayes is one Thunderbird extension you should not go without on a Windows system. Because Spam can be malevolent in nature you do not want to run the risk of any malicious code being executed on your (or your company's) system. And considering Thunderbayes works infinitely better than the Spam protection built into Thunderbird, it's a no-brainer of a decision.

Make Thunderbayes a requirement for all company Thunderbird e-mail clients. You'll be glad you did.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

6 comments
geo
geo

After reading this article I gave the ThunderBayes extension a good workout over the past few weeks on three email accounts using Windows Vista. I was very disappointed that such a recommendation would be made at TechRepublic. 1)The more you use it, the more Thunderbird slows down. 2)It never really learns all the spam, you always have to click the button for something. 3)Thunderbird will not always empty the trash on exit even though it is set up to do so. 4)You can't just deactivate it - your email will stop working. 5)If you just uninstall it, you will lose all your email settings and have to re-input them manually. Uninstall instructions are hidden as a blog on their site. 6)Another separate blog says the extension is now unsupported. This extension could cause a lot of problems for a user not familiar with email setups, ports, etc. And it does a poor job. This should never have been recommended by a quality site like TechRepublic, although that seems to be a trend. (?`?._.?ns??v??._.???)

Mark W. Kaelin
Mark W. Kaelin

Is Spam e-mail still the problem it used to be? At the office here we have a corporate Spam filtering application and at home my ISP blocks obvious Spam from reaching my inbox. Are you still being swamped by junk e-mail?

pgit
pgit

I was getting zero spam for several months, then about 3 weeks ago a new variety has been hitting me 30-40 times a day. They always come in twos, with a totally different heading each time (two of 'em) but the same content. Actually there's two types of body, slightly different. I installed this and will see how it goes. One "gotcha" I see is the gray question mark thing. If you tell it it's ham, it moves everything to the inbox. I have my mail sorted by filters. I have thousands in about a dozen custom folders. I guess forever more the older mails will be a gray question mark, as I'm not about to mix up all my mail in the inbox. A lot of it is moved by hand. The authors should account for this. Mark all preexisting mail somehow that indicates it's safe...

Dumphrey
Dumphrey

25-35 spam a week, obvious spam. So yeah, its still a problem, Im almost to the point of building a server to retreive mail for me and spam scan it befor I have to look at it.

pgit
pgit

Dude, this thing wiped ALL my server settings. BE CAREFUL. PITA, lemme tell ya.

Editor's Picks