ThunderBayes

Overview

ThunderBayes is an extension for Thunderbird that provides a toolbar button, similar to Thunderbird’s Junk button, with which email can be classified as Spam or Ham. Clicking the button causes two things to happen: (1) it sends the source of the selected messages to SpamBayes to be classified and (2) it optionally moves the messages to a folder of your choice (this can be configured in the extension options). It includes a custom version of SpamBayes, and provides a simple preference page in the Thunderbird Account Settings where the SpamBayes POP3 proxy and message filters can be configured.

Requirements/prerequisites

Everything needed to run ThunderBayes on Windows is included in the XPI file. Non-Windows users must have Python 2.2 or later (2.3 recommended) installed. It works great on Mac OS X 10.4 (it should work fine with earlier versions of Mac OS X as well).

Recommended configuration:

Configure Your accounts to use ThunderBayes

On the main menu bar select Tools->Account Settings…

Select the “ThunderBayes” pref page on any POP3 (other account types are not supported at this time).

Check “Enable ThunderBayes proxy for this account”. This will copy the real hostname and port for this account from the Server pref page to the ThunderBayes page. The Server page will be populated with the proxy hostname and port for this account. Note: this may not work if you are using an externally configured version of SpamBayes (i.e. not the internal version that ships with ThunderBayes).

Enable and configure filters if desired. You may want to do this later after you have trained SpamBayes and are confident that it is filtering mail correctly. WARNING: renaming the filters created by the ThunderBayes pref pane will prevent them from being edited from the pref pane–you will need to use the Message Filters list to edit them if you rename them.

Add the ThunderBayes “Spam” button to the toolbar. To add the button to the toolbar, right-click the toolbar and select “Customize…” Then drag the “Spam” icon into your toolbar and click “OK” on the “Customize Toolbar” dialog.

Enable the “Spam Status” column in your Inbox and other folder views by clicking the right-most column header (you should see a menu). Select the “Spam Status” item so there is a check mark beside it. The Spam Status column uses four icons to denote message status:

Spam – red circle with slash

Unsure – yellow question mark

Ham – gray dot

Unknown – gray question mark (this means the message did not have a “X-Spambayes-Classification” header, which probably means it did not pass through the SpamBayes proxy)

How to uninstall ThunderBayes

Follow these steps if decide you want to uninstall ThunderBayes:

On the main menu bar in Thunderbird select Tools->Account Settings…

Uncheck "Enable ThunderBayes for this account" on each account for which ThunderBayes is enabled.

Click Accept or OK to save the changes to Account Settings.

Go to Tools->Add-ons and uninstall ThunderBayes.

Restart ThunderBayes

Don’t worry if you already uninstalled ThunderBayes but you did not disable ThunderBayes for each account first. Just set the server and port for each account back to the real server and port that you were using before you installed ThunderBayes.

Migrating to ThunderBayes 1.0+(from any version prior to 1.0)

As of version 1.0, ThunderBayes ships with a Python interpreter (Windows only) and SpamBayes 1.0.4. This makes it very easy for anyone with Thunderbird to get ThunderBayes installed and operational. Previously it was necessary to install and configure SpamBayes before ThunderBayes actually did anything useful. If you are one of the early adopters of ThunderBayes and went through all the nuisance of setting up and configuring SpamBayes in addition to installing the ThunderBayes extension then this section applies to you. Everyone else may skip ahead to the next section. These are the steps to migrate the data from your externally configured SpamBayes to ThunderBayes’ internal version of SpamBayes. Read all of the instructions before you start the migration process.

If you skipped the previous step, go back and do it…really, you might need it if you do something wrong in the following steps. I usually like to make a zip archive of my profile so I don’t accidentally delete or change any of the files contained in it. That, and it’s easy to move around when it’s a single compressed file.

Make a new folder in your Thunderbird profile named ’spambayes_data’. The path should be something like this (the ‘default.xyz’ part will be different): <…>/Thunderbird/Profiles/default.xyz/spambayes_data

Find out where your existing SpamBayes data is stored. On Windows it might be C:\Documents and Settings\\Application Data\SpamBayes\Proxy On Mac OS X it might be in /Library/SpamBayes. If you can’t find it just search for some of the files in the next step–that should lead you to the right place.

Copy the following files and folders from your existing SpamBayes directory:

_pop3proxyham.mbox

_pop3proxyspam.mbox

bayescustomize.ini

hammie.* (i.e. any files that start with ‘hammie.’)

pop3proxy-ham-cache/* (folder and all files inside it)

pop3proxy-spam-cache/* (folder and all files inside it)

pop3proxy-unknown-cache/* (folder and all files inside it)

spambayes.messageinfo.db

Mac OS X and other Linux/Unix users: edit the bayescustomize.ini file and change each port listed on the line beginning with listen_ports to something higher than 1023. Then change each account in Thunderbird to use the new port assigned to that account (after the next step). Explanation: on Unix ports lower than 1024 are privileged and cannot be used by non-root users.

Start Thunderbird

If you haven’t already, install ThunderBayes 1.0 and restart Thunderbird

If everything went as planned you should have a fully functional ThunderBayes setup with the same SpamBayes configuration that you had before, except its now running the internal version of SpamBayes distributed with ThunderBayes. After all that, I will tell you that migrating the SpamBayes database to use the internally bundled version of SpamBayes is not strictly necessary–the internal version can simply be disabled, and you may continue to use your externally configured version of SpamBayes. However, there are a few (minor) features in ThunderBayes that will not work correctly:

The ThunderBayes server name/port configuration in Thunderbird’s Account Settings will not work. Filter configurations will work, although you’ve probably already configured your own which will continue to work as well.

ThunderBayes ships with a patched version of SpamBayes that automatically updates the “Review” page in the SpamBayes proxy web interface upon training with a given message. If you don’t know what that is you don’t have to worry about it. However, if you opt to use an external version of SpamBayes this feature will not work in ThunderBayes 1.0. It did work in ThunderBayes 0.3, which was never formally released. The feature was reimplemented in ThunderBayes 1.0 as a custom extension to SpamBayes, which is much more efficient and makes the code much simpler.

ThunderBayes will not automatically start/stop SpamBayes when Thunderbird starts/stops (obviously).

To disable the internal SpamBayes shipped with ThunderBayes go to Tools->Add- ons->Extensions->ThunderBayes->Preferences. Uncheck the “Use internal SpamBayes proxy” checkbox. Finally, a simpler option is just to disable your old SpamBayes proxy and install the new version of ThunderBayes. Configure your accounts in Thunderbird, and train from scratch. This will of course be a pain at first because you have to re-establish all of your training data, but it is very easy to get going quickly. NOTE: when you configure your accounts you will need to set the server name and port in Server Settings back to the real server name and port BEFORE you configure the ThunderBayes page in Account Settings.