This page contains example scripts for automating the process of giving SpamAssassin feedback.
Your mileage may vary. Feel free to fix bugs. Test these scripts before making use of them. Make sure you know what you're doing.
feed-site-spam: Feed uncaught spam messages to SpamAssassin.
NOTE: It is assumed that you empty your Spam folder after running this script. Otherwise you'll feed some of the same messages to SpamAssassin every time you run the script.
# Location of your spam directory SPAMDIR=~/Maildir/.Spam.Definitely/cur # Destination directory for spam messages #SHAREBASE=/etc/spamassassin # an older instance SHAREBASE=~spamd # current name circa 1/2010 SHAREDDIR=$SHAREBASE/Maildir/.SiteSpam/cur # Copy files were not marked as spam to the site folder for i in $(find $SPAMDIR -type f -print0 | xargs -0 grep -l "^X-Spam-Status: N"); do cp $i $SHAREDDIR done
# Prefix for folder locations MAILPRE=~/Maildir/. # IMAP directories that contain definite non-spam (ham) HAMDIRS="Bugs Family Friends Fun Gnu Info Lists Plug School Work" # Destination directory for ham messages #SHAREBASE=/etc/spamassassin # an older instance SHAREBASE=~spamd # current name circa 1/2010 SHAREDDIR=$SHAREBASE/Maildir/.SiteHam/cur # Copy files that were erroneously marked as spam to the site folder. # Note: This includes email with a spam level of 3 or higher, # 30 days old or less. for i in $HAMDIRS; do echo Learning ham in $i: for i in $(find $MAILPRE$i/cur -type f -ctime 30 -print0 | xargs -0 grep -l "^X-Spam-Level:.*\*\*\*"); do cp $i $SHAREDDIR done done