#!/bin/bash # sa-quicktrain # Copyright 2006, Faisal N. Jawdat, faisal@faisal.com # Version 0.01 # License # Permission is granted to use and modify under the terms of the Apache # License, Version 2.0, # as of January 2004. Please read the license # here: # http://www.apache.org/licenses/LICENSE-2.0 # # Special thanks to The Obscure Organization, http://www.obscure.org/ # for supporting this project. Additional thanks to Chris Heiser, and # Richard Bullington, for comments and suggestions. # If you're feeling especially daring you can: # comment out the "mailutil appenddelete" lines # uncomment the triplet below each of them # # We don't use the commented out triplets because if anything goes # wrong with the procmail pipe the mailutil will still fire. This # translates to: THIS MAY WIND UP DELETING MAIL YOU DO NOT WANT # DELETED. DO NOT DO THIS UNLESS YOU'RE WILLING TO TAKE THAT CHANCE. alias sa-learn=/usr/bin/sa-learn alias mailutil=/usr/bin/mailutil export MAILDIR="$HOME/Maildir" export TRAINSPAMDIR="$MAILDIR/.Train.Spam/" export SPAMDIR="$MAILDIR/.Spam/" sa-learn --spam $TRAINSPAMDIR 1> /dev/null mailutil appenddelete $TRAINSPAMDIR $SPAMDIR 1> /dev/null # cd $TRAINSPAMDIR # for file in `\ls`; do cat $file | procmail; done # mailutil prune $TRAINSPAMDIR "ALL" export TRAINHAMDIR="$MAILDIR/.Train.Ham/" export HAMDIR="$MAILDIR/" sa-learn --ham $TRAINHAMDIR 1> /dev/null mailutil appenddelete $TRAINHAMDIR $HAMDIR 1> /dev/null # cd $TRAINHAMDIR # for file in `\ls`; do cat $file | procmail; done # mailutil prune $TRAINHAMDIR "ALL"