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.


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.


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.