test
[hcoop/zz_old/ikiwiki] / FeedingSpamAssassin.mdwn
CommitLineData
ee25310d 1\r
2This page contains example scripts for automating the process of\r
3giving SpamAssassin feedback.\r
4\r
5= Warning =\r
6\r
7Your mileage may vary. Feel free to fix bugs. Test these scripts\r
8before 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
15running this script. Otherwise you'll feed some of the same messages\r
16to 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
22SPAMDIR=~/Maildir/.Spam.Definitely/cur\r
23\r
24# Destination directory for spam messages\r
25SHAREDDIR=/etc/spamassassin/Maildir/.SiteSpam/cur\r
26\r
27# Copy files were not marked as spam to the site folder\r
28for i in $(find $SPAMDIR -type f -print0 | xargs -0 grep -l "^X-Spam-Status: N");\r
29do\r
30 cp $i $SHAREDDIR\r
31done\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
41MAILPRE=~/Maildir/.\r
42\r
43# IMAP directories that contain definite non-spam (ham)\r
44HAMDIRS="Bugs Family Friends Fun Gnu Info Lists Plug School Work"\r
45\r
46# Destination directory for ham messages\r
47SHAREDDIR=/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
52for 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
58done\r
59}}}\r