Bayes?

Julian Field mailscanner at ecs.soton.ac.uk
Fri Mar 21 14:57:08 GMT 2003


At 14:51 21/03/2003, you wrote:
>Just qurious about spamassassins bayes function in connection with MS.
>Is MS utilizing the bayes function automatically

Yes.

>  or do you have to
>configure something to make it work?

No.

>  If so what, and do you have to
>run a "learning session" with it?

No.

>  That is, do you have to run some
>definitly SPAM emails and some non SPAM emails through it?

No.

MailScanner is using the bayes function automatically. Uniquely, the bayes
engine in SpamAssassin is "self-learning"; it uses the other rules to
identify messages which have either a very high score or a very low score,
and it continuously feeds them to the bayes engine itself without you
needing to do anything.

If you want to teach it when it gets it wrong, you can have it run the
"sa-learn" script to learn about particular messages. I have set up 2
addresses here, "spam" and "notspam". Their mailboxes live on the main
MailScanner server, and people can just redirect wrongly-classified
messages to one of the addresses. Then once an hour the script below is run
by cron to teach the bayes engine about the messages it got wrong. For the
script below, I have copied SpamAssassin's "sa-learn" script into the
MailScanner bin directory.

You should also run a nightly cron job that does a "sa-learn --rebuild" as
well, to do all the housekeeping the Bayes engine requires.

#!/bin/sh

SPAM=/var/mail/spam
NOTSPAM=/var/mail/notspam

LOGFILE=/var/log/learn.spam.log
PREFS=/opt/MailScanner/etc/spam.assassin.prefs.conf
SALEARN=/opt/MailScanner/bin/sa-learn

date >> $LOGFILE
if [ -f $SPAM ]; then
   BOX=${SPAM}.processing
   mv $SPAM $BOX
   sleep 5 # Wait for writing current message to complete
   $SALEARN --prefs-file=$PREFS --spam --mbox $BOX >> $LOGFILE 2>&1
   rm -f $BOX
fi

if [ -f $NOTSPAM ]; then
   BOX=${NOTSPAM}.processing
   mv $NOTSPAM $BOX
   sleep 5 # Wait for writing current message to complete
   $SALEARN --prefs-file=$PREFS --ham --mbox $BOX >> $LOGFILE 2>&1
   rm -f $BOX
fi

--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support



More information about the MailScanner mailing list