# SpamBayes Configuration

Most SpamBayes configuration options are managed via the SpamBayes Manager, available from the SpamBayes toolbar. While this dialog allows you to configure standard options, there are a number of other (typically advanced or experimental) options that can be set manually.

WARNING: Please read the following before going any further:

- To change these options, you will need to use a text editor to edit configuration files. If something goes wrong, you may lose your existing SpamBayes configuration (this will not effect your training data). Making a copy of any files you edit is recommended.
- SpamBayes stores all configuration options, including the list of folders, in this file. Do not change anything you don't understand. Some of these lines are extremely long - please ensure they remain as a single line.
- Before manually changing any configuration files, please ensure you have shut down Outlook - otherwise the configuration changes you have made will be lost if SpamBayes itself automatically saves its configuration.

If you have any further questions, please post them to the SpamBayes mailing list.

## Quick links

Configuration overview

Editing the configuration files

Available options

Simple example - Outlook

Simple example - SpamBayes

## Configuration overview

The Outlook plug-in uses two sets of configurations - one contains option values specific to the Outlook plug-in, and the other contains option values that are also used by other SpamBayes applications. It is important that you edit the correct file - if you place option values in the wrong file, they will have no effect.

All options from all configuration files are "merged". This means that any file can set any option. If multiple configuration files specify the same option, the value from the file last loaded is used. When SpamBayes writes its configuration during normal processing, the entire merged set of options is written. The end result of this means that next time SpamBayes is run, the earlier configuration files will have no effect, as the last one loaded (the main config file written by SpamBayes) will have all values already.

### Outlook configuration files

The Outlook plug-in looks for configuration files as follows:

1. A file named `default_configuration.ini` in the `bin` directory in the directory you installed SpamBayes into (by default `C:\Program Files\SpamBayes`). By default, no such configuration file will exist.
2. A file named `default_configuration.ini` in a `SpamBayes` directory in the Windows Application Data directory (e.g. with Windows XP this is `\Documents and Settings\{username}\Application Data\SpamBayes`). By default, no such configuration file will exist. This is the default SpamBayes data directory.
3. A file named `{outlook-profile-name}.ini` in the data directory. Using the name of the Outlook profile means that SpamBayes will work in a multi-profile environment.

### General SpamBayes configuration files

The Outlook plug-in looks for configuration files as follows:

1. A file named `default_bayes_customize.ini` in the `bin` directory in the directory you installed SpamBayes into (by default `C:\Program Files\SpamBayes`).
2. A file named `default_bayes_customize.ini` in a `SpamBayes` directory in the Windows Application Data directory (e.g. with Windows XP this is `\Documents and Settings\{username}\Application Data\SpamBayes`). By default, no such configuration file will exist.
3. A file named `{outlook-profile-name}_bayes_customize.ini` in the data directory. Using the name of the Outlook profile means that SpamBayes will work in a multi-profile environment. By default, no such configuration file will exist.

## Editing the configuration files

The configuration files are plain text files, and can be edited in any text editor (such as `Notepad`). The format for both the Outlook-specific configuration files and the general SpamBayes configuration files is the same; only the available options differ.

A configuration file has a number of sections, and each section contains a number of named values. For example:

    [Filter]
    enabled:True
    save_spam_info:False

Note that section, option, and (usually) values are all case-sensitive. In other words, `General` is not the same as `general`.

This assigns the value `True` to an option named `enabled`, and the value `False` to an option named `save_spam_info`, both in a section named `Filter`.

If you want to set an option in a section that doesn't exist in your file, just add a line with the section header above the option name. Likewise, if you want to set an option in a file that doesn't exist (e.g. `default_configuration.ini`), you will have to create the file. `Notepad`, or any other text editor, can be used to create and edit .ini files.

A configuration file pre-filled with all default values (for Outlook-specific or general SpamBayes) can be used as a starting point if you would find that easier.

## Available options

You can see a list of Outlook-specific options, or a list of general SpamBayes options that can be manually set in this release.

## Simple example - Outlook

A simple example to move your >data directory to a new location: `C:\New Folder`.

1. Close Outlook, so that any changes made will be effective.
2. Look in the table above and see that the applicable option is called `data_directory`, it is in the `General` section.
3. This option needs to be set before the configuration file in the data directory is loaded (otherwise it is obviously too late), so it can be put in `C:\Program Files\SpamBayes\bin\default_configuration.ini` or in the default data directory location. This example will use the former.
4. By default this file will not exist, so use `Notepad` to create it.
5. The file only has two lines, like this:

    [General]
    data_directory: C:\New Folder

(If more options were being set, the file would be longer.)

6. Name the file `default_configuration.ini` and save it in `C:\Program Files\SpamBayes\bin`.
7. Open Outlook.
8. To check that the new data directory is being used, click the `Show Data Folder` button on the `Advanced` tab of the main SpamBayes Manager dialog. This should open the new data directory (`C:\New Folder`, here).

## Simple example - SpamBayes

A simple example to enable the "Use Bigrams" option.

1. Close Outlook, so that any changes made will be effective.
2. Look in the table above and see that the applicable option is called `use_bigrams`, it is in the `Classifier` section.
3. This option can be in any configuration file. This example will use the `default_bayes_customize.ini` file in the data directory.
4. By default this file will not exist, so use `Notepad` to create it.
5. The file only has two lines, like this:

    [Classifier]
    use_bigrams: True

(If more options were being set, the file would be longer.)

6. Name the file `default_bayes_customize.ini` and save it in the SpamBayes data directory.
7. Open Outlook.
8. This option recommends retraining after enabling it, so do so via the `Training` tab of the `SpamBayes Manager`.