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