3-Minute Procmail-based Setup
-------------------------------------

What you will have after doing all this:

* All your existing mail will have a new "X-Spambayes-Trained" header.
  Spambayes uses this to keep track of which messages it's already
  learned about.
* Spambayes will look at all your incoming mail.  Messages it thinks are
  spam will be put in a "spam" mail folder.  Everything else will be
  delivered normally.
* Every morning, spambayes will go through your mail folders and train
  itself on any new messages.  It will also pick up mail that's been
  re-filed: something it thought was ham but was actually spam, and
  vice-versa.  Be sure to keep spam in your spam folder for at least a
  day or two before deleting it--I suggest keeping it for a full year,
  just in case you need to re-train spambayes.

-----

What you need:

* the spambayes package
* Python 2.2.2 or newer
* a text editor
* procmail (most systems have this)
* a working crond (most systems have this)
* (optional) a mailbox full of spam and a mailbox full of ham

-----

Instructions:

1.  Download the spambayes package.  I'll assume you've put it in
    $HOME/src/spambayes.

2.  Create a new database:

      $HOME/src/spambayes/hammiefilter.py -n

3.  (optional) Train it on your existing mail:

      $HOME/src/spambayes/mboxtrain.py -d $HOME/.hammiedb -g $HOME/Mail/inbox -s $HOME/Mail/spam

    You can add additional folder names if you like, using -g for "good"
    mail folders, and -s for "spam" folders.

4.  Add the following two recipies to the top of your .procmailrc:

      :0fw
      | $HOME/src/spambayes/hammiefilter.py

      :0
      * ^X-Spambayes-Classification: spam
      $HOME/Maildir/.spam/

    The above is for the maildir message format.  If you need mbox (the
    default on many systems) or MH, the second recipie should look
    something like this:

      :0:
      * ^X-Spambayes-Classification: spam
      $HOME/Mail/spam

    If you're not sure what format you use, ask your system
    administrator.  If you are the system administrator, check the
    documentation of your mail program.  With the notable exception of
    Pine, which can only read mbox format unless patched, most modern
    MUAs can handle both Maildir and mbox formats.

5.  Add the following cron job to train on new or refiled messages every
    morning at 2:21am ("crontab -e" with vixie cron, the default on most
    Linux systems):

      21 2 * * * $HOME/src/spambayes/mboxtrain.py -d $HOME/.hammiedb -g $HOME/Mail/inbox -s $HOME/Mail/spam

    As in step 3, you can add additional folder names here too.  It's
    important to do so if you regularly file mail in different folders,
    since otherwise spambays will never learn anything about those
    messages.

6.  Spambayes should now be filtering all your mail and training itself
    on your mailboxes.  Occasionally a message will be misfiled.  Just
    move that message to the correct folder, and spambayes will learn
    from its mistake the next morning.
    
-----

That's it!  You're all done.

If you have questions or comments about these instructions, please mail
them to neale-spambayes@woozle.org.

Neale Pickett
