SpamAssassin Notes

When I get a better understanding of SpamAssassin config files, I will document that here, but I'm kind of stumbling along with that at the moment.

What I have done is set up some a cron job to automaticly train the user-specific bayesian detection.

I currently have my mail set up so that I manually move false negatives (undetected spam) to ~/TrainingSpam, and false positives (desirable mail, identified as spam) to ~TrainingHam.

  1. Create a cron entry like:
    22 2 * * * ~/bin/TrainSpam
    44 2 * * 0 cd ~;cp INBOX.Trash tmp;head -13 tmp/INBOX.Trash>INBOX.Trash
    
    The first entry runs my training script, the second (optional) entry rotates my trash file to tmp every week. So trash is held for 1-2 weeks, then lost. I need the head -13 to keep the mailbox preamble in tact for my mail program.
  2. Create the script ~bin/TrainSpam containing:
    #!/bin/sh
    
    # script to update SpamAssassin baysian spam training
    
    cd ~
    LOGFILE=tmp/SpamTraining.log
    SPAM=TrainingSpam
    HAM=TrainingHam
    
    date >> $LOGFILE
    
    echo Spam: >> $LOGFILE
    /usr/bin/sa-learn --spam --mbox $SPAM >> $LOGFILE 2>&1
    cp $SPAM tmp
    head -13 tmp/$SPAM > $SPAM
    
    echo Ham: >> $LOGFILE
    /usr/bin/sa-learn --ham  --mbox $HAM  >> $LOGFILE 2>&1
    cp $HAM tmp
    head -13 tmp/$HAM > $HAM
    
    date >> $LOGFILE
    
Details will change for your system, but this gives the idea.
Aaron Birenboim
Last modified: Wed Nov 23 08:12:46 MST 2005