Spam Reporting Address

Julian Field MailScanner at ecs.soton.ac.uk
Mon Apr 3 09:08:06 IST 2006


On 3 Apr 2006, at 07:57, Craig Retief ((CSFS)) wrote:
> Is it possible to set up an email address on a server that  
> mailscanner picks up as a spam reporting address to which the users  
> can forward emails that the users consider spam for SpamAssassin to  
> learn from.
Funnily enough, it's already there. Your users must "redirect" or  
"bounce" their message to the address, as "forward" results in all  
sorts of mangling happen to the message on the way.

All you need to do is collect that mail in a mailbox on your  
MailScanner server, run sa-learn on it, move it to the end of a  
"cumulative" file, and repeat every day.

You want to move it out of the way as otherwise you will be re- 
teaching SpamAssassin stuff it has already seen, which is a waste of  
time. But I would still keep it so you can re-teach it all if your  
Bayes db dies/corrupts.

Start by reading the docs for "sa-learn", it can slurp in an entire  
Unix mbox format mailbox at one go (with the "--mbox" switch).

Hope that helps get you started.

Here's the cron job I use to do it, which you might find useful.

#!/bin/sh

SPAM=/var/spool/mail/spam
NOTSPAM=/var/spool/mail/notspam
TOTAL=.cumulative

LOGFILE=/var/log/learn.spam.log
#PREFS=/etc/MailScanner/spam.assassin.prefs.conf
SALEARN=/usr/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 --spam --mbox $BOX >> $LOGFILE 2>&1
   cat $BOX >> ${SPAM}${TOTAL}
   echo >> ${SPAM}${TOTAL}
   rm -f $BOX
fi

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


-- 
Julian Field
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20060403/6412434b/attachment.html


More information about the MailScanner mailing list