Troubleshooting the SpamBayes Outlook plugin

# Troubleshooting the SpamBayes Outlook addin

This is a list of common problems, and hopefully their solutions. Please feel free to suggest additional topics. Currently, we have the following problems listed:

- Toolbar items appear, but fail to work
- Addin loads with an error message
- Addin doesn't load
- Messages fail to filter
- Messages have incorrect or unexpected Spam values
- Resetting SpamBayes configuration
- SpamBayes is not available for all users on the machine
- All other problems

Some other resources that may be useful in tracking down any problems:

- There is an online FAQ for SpamBayes with lots of information, including a section specific to the Outlook addin.
- The latest online version of this document may have information added since release.
- The online Frequently Reported Outlook Bugs list has the most common problems people are experiencing, and links to more information about the bug.
- Check to see that you are using the most recent version - it is possible that your problem has been fixed in a newer release. You should be able to check for newer versions by selecting `Check for new version` from the SpamBayes menu - otherwise, you can visit the SpamBayes website and check there.

If you must send someone a mail about SpamBayes, please read this first.

## Toolbar items appear, but fail to work

If the toolbar items fail to work, we are facing one of two problems.

- The addin has failed to load. In this case, along with the toolbars failing to work, SpamBayes will not be filtering or scoring any messages. To fix this, see the Addin doesn't load instructions.
- If the addin has loaded (ie, is filtering and scoring mail) but the toolbar items don't, we have struck a common problem with the toolbars. Follow the instructions below.

First we will try deleting the toolbar, and if that fails, completely reset all Outlook toolbars. Perform the following steps:

- Right-click on any Outlook toolbar, and select Customize.
- In the dialog that appears, ensure the `Toolbars` tab is selected, locate SpamBayes in the list of toolbars, and select it.
- Click on the Delete button. Outlook will ask for confirmation that you want to delete the SpamBayes toolbar. Select OK.
- Close the customize dialog. The SpamBayes toolbar no longer appear.
- Restart Outlook. SpamBayes will re-create the toolbar.

If all else fails, you can completely reset the Outlook toolbars by removing the file `\Documents and Settings\{username}\Application Data\Microsoft\Outlook\outcmd.dat` Although this is undocumented by Microsoft, we have never heard reports of problems. If you are paranoid, simply rename this file so that you have a copy.

## Addin loads with an error message

In this case, when you start Outlook you receive a message indicating that SpamBayes could not be initialized.

This means that SpamBayes has loaded, but struck an error during initialization. If the information in the error message does not indicate the nature of the error, please report a bug (making sure you attach the log file).

## Addin doesn't load

If you start Outlook but there was no error message, the SpamBayes toolbar items do not work and new messages have no spam score or filtering applied, then the plugin has probably become disabled.

- Check the log file. If a log file for this session exists, then see if it contains an error. If not, check the date and time of the log - it is probably a log from the last time it did work, so is no help to us. If a log does exist, please report a bug.
- Check that Outlook shows the addin as enabled.

If you are running from source code, the addin will not appear in the steps below. Please re-register the addin, as per the README.txt file.

1. Start Outlook, and select `Options` from the `Tools` menu to display the main Options dialog.
2. Select the tab labeled `Other`, then click on the `Advanced` button.
3. Click on the `COM Add-Ins` button.
4. If the SpamBayes addin is not listed, then SpamBayes should be reinstalled (Note that running `regsvr32.exe outlook_addin.dll` or `bin\outlook_addin_register.exe` from the SpamBayes directory may also solve this problem).
5. If the SpamBayes addin is listed but not checked, then simply check it and close the dialog.
6. If you are running Outlook XP/2002/2003, you may find that if you go back to the dialog, the addin will still be unselected. In this case, perform the following:

1. Select `About Microsoft Outlook` from the `Help` menu.
2. Click the Disabled Items button.
3. Select SpamBayes.
4. Click Enable.
5. Restart Outlook.

If none of that works, please report a bug.

## Messages fail to filter

This is when messages arrive, but have no `spam` field value. Note that this is different from a message having an incorrect or unexpected spam value. This is for messages that have a completely blank spam score. To resolve this:

- Check that filtering is enabled. Select the SpamBayes Manager, then ensure the button Enable Filtering is checked. If you are unable to select this button due to insufficient training information, please review the initial configuration documentation for information on training.
- If only the occasional message fails to filter, then it is likely that the message is in a format we don't understand. There is almost certainly an error listed in the log file. Please report a bug, attaching both the log file and the message that caused the error.
- If all messages fail to filter, we have a more serious problem but again, please report a bug, attaching the log file.

## Messages have incorrect or unexpected spam values

This is when filtering appears to work OK, except that the spam values are wrong. To resolve this:

- If the messages are all scoring as "unsure", with a score of 0.5, then you may have lost your training database. From the `SpamBayes Manager` dropdown, check how many spam and good messages have been loaded by the system. If this number is very low (like zero!) then you probably need to perform a full re-train of your database.
- If the messages have apparently random, but unexpected scores, then there are two possibilities; either SpamBayes is simply behaving what appears to be strangely, but really is correctly, or that some of the spam payload is invisible to SpamBayes. In both cases, perform the following:

- Ensure the message is selected in the Outlook preview pane, and from the `SpamBayes Manager` dropdown, select `Show Spam clues for current message`. This should open a new mail message with the clues.
- Part of the clues shows the body of the spam message. If this message correctly shows the spam text, then it is likely SpamBayes is behaving correctly. In this case, you may wish to mail the clues to the SpamBayes mailing list for help in decoding the clues, but it is likely that SpamBayes is behaving correctly given your current training data.
- If it appears that part of the spam payload is missing, then you have probably stumbled across a bug - please mail the clues to the mailing list.

## Resetting SpamBayes configuration

In some cases, it may become necessary to reset your SpamBayes configuration, especially if your configuration becomes invalid. SpamBayes attempts to detect this situation, but doesn't always get it right. This section details where critical configuration files are stored - more detailed information is also available.

SpamBayes stores all configuration data in your data directory. The configuration information is stored in a file called `[profile name].ini`, where `profile name` is the name of your Microsoft Outlook profile. The default profile name is usually `Outlook` or `Microsoft Outlook Internet Settings`, but Outlook can be configured to use any number of profiles, with any name.

Note that, in this directory, you may also find a file named `default_bayes_customize.ini` - this file is not used to configure the Outlook side of SpamBayes - look for any other .ini files in that directory.

If you delete the configuration file, SpamBayes will be completely reset. Note you will not lose your training data, only your configuration information. The next time you start Outlook, the SpamBayes configuration wizard should appear, guiding you through the configuration process

Your training data is also stored in this directory, but in files with a `.db` extension. If you ever want to delete your training information, remove the two `.db` files in this directory.

You may like to consider backing up this directory.

## SpamBayes is not available for all users on the machine.

When SpamBayes is installed, by default it is available only for the user who installed it. This is to allow SpamBayes to appear in Microsoft Outlook's COM-Addin list, and therefore able to be activated and de-activated by the user inside Outlook.

It is possible to register the addin so it is available to all users on a particular machine, which can be useful in enterprise arrangements where users have 'roaming profiles'.

To register SpamBayes in this way, you must log on as a user with permissions to modify the system registry, then execute the command (with the correct path substituted):

`"c:\Program Files\SpamBayes\bin\outlook_addin_register.exe" hkey_local_machine`

Note that the double-quotes in the above command are significant (and should be typed). Because "Program Files" has a space in it, you must surround the entire command name with quotes. Otherwise, you'll get an error something like:

`'c:\Program' is not recognized as an internal or external command, operable program or batch file.`

If you check the installation log after performing such an install, you should see the following messages:

`Registered: SpamBayes.OutlookAddin
Registration complete.
Registration (in HKEY_LOCAL_MACHINE) complete.`

Note the last line, which does not exist when registration is performed only for the current user. Once you have performed this registration, the Addin will be available for all users - but as noted above, it will no longer appear in Outlook's COM-Addin list.

## All other problems

If you are simply unsure about what SpamBayes is doing, please send a mail to the SpamBayes mailing list with as much information as possible. If you are fairly sure you have struck a bug, then please report it. Please do not mail any of the contributors directly.

## Process Descriptions

This explains some of the processes above in more detail.

### Determine your installation type.

If you are running from Python source code, and installed Python, plus SpamBayes as separate components, then you are running the `source code version`. If you downloaded an installer .exe file, then you are running the `binary version`.

### Check the log file

Determine your installation type. If you are running the source code version, then please see README.txt in the Outlook2000 directory.

If you are running the binary version, the simplest way to get hold of the most recent log is to:

1. Open the `SpamBayes Manager` dialog (from the SpamBayes toolbar).
2. Click the `Advanced` tab.
3. Click the `Diagnostics` button.
4. Click the `View log` button.

To find the log manually, you'll need to find your Windows temp directory, into which the SpamBayes addin writes the log. This directory is generally `\WINDOWS\TEMP` for Windows 95, 98 and ME, or `\Documents and Settings\{username}\Local Settings\Temp` for Windows 2000/XP.

Note that by default, in Windows 2000 and XP, Windows Explorer will not show the `Local Settings` directory. You can convince Windows Explorer to show this directory (and therefore allow you to see the `Temp` directory under it) by doing either:

- Select the folder `\Documents and Settings\{username}`.

This directory should be reflected in the Address Bar.

- In the Address Bar, simply type, at the end, `\Local Settings` (thereby giving the full path name), and press `Enter`.

Windows Explorer will then show this folder, and you can open the Temp folder, which is in it.

or

- Select `Folder Options` from the `Tools` menu.
- Select the `View` tab.
- In the list, select `Show hidden files and folders`.
- Select OK.

- The temp folder will now be visible, and you can then open it. You may like to then reset this option back to the default value.

The log file for the most recent execution of Outlook is named `spambayes1.log`, the second most recent is named `spambayes2.log`, and so on for the four previous runs. You can view this file with `Notepad`. Usually, you will simply see messages which indicate that SpamBayes is doing its job; however in some cases there will be errors in this file. If there are errors, please report a bug.

#### If the log file is very large

This probably means that SpamBayes failed to process a large number of (or a few, large) emails. In that case, please perform the following steps:

- Ensure all messages in your watch folders are marked as read.
- Restart Outlook (use `Exit and Sign off` if it is in your `File` menu)
- Send yourself a test message, and wait for it to arrive.
- Exit Outlook.

You should have a new log file containing the error when classifying the test message. If no error occurs processing the test message, the previous large log file will still exist (see above). Either edit the file using a text editor to extract just the error information, or zip it up. If you don't know what that means, please send a mail.

### Locating your Data Directory

SpamBayes stores all configuration and database information in a single directory. By default, this directory is located under the user's `Application Data` directory. You can locate this directory by using the `Show Data Folder` button on the `Advanced` tab of the main SpamBayes Manager dialog.

If you need to locate it by hand, on Windows NT/2000/XP, it will probably be `C:\Documents and Settings\{username}\Application Data\Spambayes`, or on other versions of Windows it will probably be `C:\Windows\Application Data\Spambayes`.Note that the `Application Data` folder may be hidden, so Windows Explorer may not show it by default, but you can enter the path into the Address Bar and Explorer will open it.

Note that by modifying the configuration files, you can tell SpamBayes to store this data in any directory, so it is possible your data is being stored elsewhere - contact your network administrator if this appears to be the case.

### Report a bug

All SpamBayes bugs are maintained in on a page at sourceforge. Please have a check of the bugs already reported to see if your bug has already been reported. If not, open a new bug, making sure to set the Category to `Outlook`. Please ensure you attach the log file to the bug.

If you are unsure about the bug, or need any assistance, please send a mail.

### Send a mail

If all else fails, you may want to send someone a mail. Please make sure you have read this document thoroughly before doing do.

Your mail should be sent to the SpamBayes mailing list (spambayes@python.org). Please do not mail any of the contributors directly! (see "good karma" below).

Please ensure this mail contains:

- the version of Windows you are using,
- the version of SpamBayes,
- any log files.

If you also mention that you read this trouble-shooting guide and are still stuck, then you will be more likely to get answered! (And if you can subscribe to this mailing list and help answer other questions, and good karma will come your way!)