test
[hcoop/zz_old/ikiwiki] / FeedingSpamAssassin.mdwn
diff --git a/FeedingSpamAssassin.mdwn b/FeedingSpamAssassin.mdwn
new file mode 100755 (executable)
index 0000000..98aa92c
--- /dev/null
@@ -0,0 +1,59 @@
+\r
+This page contains example scripts for automating the process of\r
+giving SpamAssassin feedback.\r
+\r
+= Warning =\r
+\r
+Your mileage may vary.  Feel free to fix bugs.  Test these scripts\r
+before making use of them.  Make sure you know what you're doing.\r
+\r
+= Scripts =\r
+\r
+'''feed-site-spam''': Feed uncaught spam messages to SpamAssassin.\r
+\r
+'''NOTE''': It is assumed that you empty your Spam folder after\r
+running this script.  Otherwise you'll feed some of the same messages\r
+to SpamAssassin every time you run the script.\r
+\r
+{{{\r
+#!/bin/bash\r
+\r
+# Location of your spam directory\r
+SPAMDIR=~/Maildir/.Spam.Definitely/cur\r
+\r
+# Destination directory for spam messages\r
+SHAREDDIR=/etc/spamassassin/Maildir/.SiteSpam/cur\r
+\r
+# Copy files were not marked as spam to the site folder\r
+for i in $(find $SPAMDIR -type f -print0 | xargs -0 grep -l "^X-Spam-Status: N");\r
+do\r
+    cp $i $SHAREDDIR\r
+done\r
+}}}\r
+\r
+\r
+'''feed-site-ham'''\r
+\r
+{{{\r
+#!/bin/bash\r
+\r
+# Prefix for folder locations\r
+MAILPRE=~/Maildir/.\r
+\r
+# IMAP directories that contain definite non-spam (ham)\r
+HAMDIRS="Bugs Family Friends Fun Gnu Info Lists Plug School Work"\r
+\r
+# Destination directory for ham messages\r
+SHAREDDIR=/etc/spamassassin/Maildir/.SiteHam/cur\r
+\r
+# Copy files that were erroneously marked as spam to the site folder.\r
+# Note: This includes email with a spam level of 3 or higher,\r
+#       30 days old or less.\r
+for i in $HAMDIRS; do\r
+    echo Learning ham in $i:\r
+    for i in $(find $MAILPRE$i/cur -type f -ctime 30 -print0 | xargs -0 grep -l "^X-Spam-Level:.*\*\*\*");\r
+    do\r
+        cp $i $SHAREDDIR\r
+    done\r
+done\r
+}}}\r