How do I bogofilter out spam?

Bogofiltler needs train/retrain often to make it works 100%
See this URL for how it works
http://www.bogofilter.org/

We use the term "ham "for email you want, "spam" for email you don't want.  We also assume you save your ham/spam and others email in mail/ folder.  See Notes below of you only have Mail (uppercase) folder.

  1. Login to  SUN Unix server only.
  2. ssh your_login@stat.ubc.ca  (Be.stat.ubc.ca)

I have have a copy of spam folder for you to start training bogofilter manually.

First step, you need to save lot of spam email to train bogofilter. 

          bogofilter -sM < /usr/local/data/etc/bogofilter/spam
 

Second step, you need "ham" email to train bogofilter. 
You can use any saved email (good known emails) as ham.
          bogofilter -nM <  mail/ham  
or 
          bogofilter -nM < mail/tha

NOTES: If you only see Mail (Uppercase) folder, do this 
          ln -s Mail mail
        
Bogofiler will store your database in your home dir ~/.bogofilter/wordlist.db

Edit your .procmail file using vi or emacs or pico by typing 
         vi ~/.procmailrc

  1. Add to content below:

    :0fw

    | /usr/local/bin/bogofilter -u -e -p

    :0e

    { EXITCODE=75 HOST }

    :0:

    * ^X-Bogosity: Spam, tests=bogofilter

    mail/Bspam

    :0:

    * ^X-Bogosity: Unsure, tests=bogofilter

    mail/Bunsure

    # Used during vacation: forwards to vacation, then makes a cc for # myself

    # Unhash 2 lines below to turn on your vacation

    #:0 c

    #|/usr/bin/vacation -t1d $LOGNAME

    Notes:  "Bunsure" and  "Bspam" are two "spam" and "not sure" spam files that bogofilter saved for you in the mail folder.  You need to check them often to make sure you don't have false positive or false negative. You need to sort  "Bunsure" and  "Bspam" into real "ham" and "spam" and "re-train "your filter to update your bogofitler database (wordlist.db)
                         

To enable the filter type

           vi ~/.forward

and add this line (Note: include the double quotes " ")
"|exec /usr/local/bin/procmail"

When you need to turn on vacation, do not use the "vacation" command to turn your vacation command. Instead add this line to your .procmailrc
# Used during vacation: forwards to vacation, then makes a cc for myself

:0 c

|/usr/bin/vacation -t1d $USER
Automation:
If you setup your as describe above, you can setup a cronjob to update your wordlist.db hourly
   crontab -e     (crontab editor = vi mode.  You can changes by edit your shell environment EDITOR=emacs)
               0 * * * * /usr/local/bin/bgupdate > /dev/null 2>&1

Manual update:
  After saving your new spam/ham form Bspam and Bunsure, run this
         bgupdate

You may need to run it twice the first time.


Advance option: Personalize your bogofilter:
If you want personal configuration for bogofilter, just copy this file /nfs/packages/bogofilter/etc/bogofilter.cf.example to your bogofilter directory.
cp /nfs/packages/bogofilter/etc/bogofilter.cf.example ~/.bogofilter/bogofilter.cf
FAQ Category