ee25310d |
1 | \r |
2 | This page contains example scripts for automating the process of\r |
3 | giving SpamAssassin feedback.\r |
4 | \r |
5 | = Warning =\r |
6 | \r |
7 | Your mileage may vary. Feel free to fix bugs. Test these scripts\r |
8 | before making use of them. Make sure you know what you're doing.\r |
9 | \r |
10 | = Scripts =\r |
11 | \r |
12 | '''feed-site-spam''': Feed uncaught spam messages to SpamAssassin.\r |
13 | \r |
14 | '''NOTE''': It is assumed that you empty your Spam folder after\r |
15 | running this script. Otherwise you'll feed some of the same messages\r |
16 | to SpamAssassin every time you run the script.\r |
17 | \r |
18 | {{{\r |
19 | #!/bin/bash\r |
20 | \r |
21 | # Location of your spam directory\r |
22 | SPAMDIR=~/Maildir/.Spam.Definitely/cur\r |
23 | \r |
24 | # Destination directory for spam messages\r |
25 | SHAREDDIR=/etc/spamassassin/Maildir/.SiteSpam/cur\r |
26 | \r |
27 | # Copy files were not marked as spam to the site folder\r |
28 | for i in $(find $SPAMDIR -type f -print0 | xargs -0 grep -l "^X-Spam-Status: N");\r |
29 | do\r |
30 | cp $i $SHAREDDIR\r |
31 | done\r |
32 | }}}\r |
33 | \r |
34 | \r |
35 | '''feed-site-ham'''\r |
36 | \r |
37 | {{{\r |
38 | #!/bin/bash\r |
39 | \r |
40 | # Prefix for folder locations\r |
41 | MAILPRE=~/Maildir/.\r |
42 | \r |
43 | # IMAP directories that contain definite non-spam (ham)\r |
44 | HAMDIRS="Bugs Family Friends Fun Gnu Info Lists Plug School Work"\r |
45 | \r |
46 | # Destination directory for ham messages\r |
47 | SHAREDDIR=/etc/spamassassin/Maildir/.SiteHam/cur\r |
48 | \r |
49 | # Copy files that were erroneously marked as spam to the site folder.\r |
50 | # Note: This includes email with a spam level of 3 or higher,\r |
51 | # 30 days old or less.\r |
52 | for i in $HAMDIRS; do\r |
53 | echo Learning ham in $i:\r |
54 | for i in $(find $MAILPRE$i/cur -type f -ctime 30 -print0 | xargs -0 grep -l "^X-Spam-Level:.*\*\*\*");\r |
55 | do\r |
56 | cp $i $SHAREDDIR\r |
57 | done\r |
58 | done\r |
59 | }}}\r |