<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FeedingSpamAssassin</title><revhistory><revision><revnumber>4</revnumber><date>2013-01-14 09:13:19</date><authorinitials>ClintonEbadi</authorinitials><revremark>cat / a bit outdated</revremark></revision><revision><revnumber>3</revnumber><date>2010-01-26 01:09:27</date><authorinitials>nc-71-50-140-208.dyn.embarqhsd.net</authorinitials><revremark>SpamAssassin shared maildir has moved since this page was written</revremark></revision><revision><revnumber>2</revnumber><date>2008-07-07 04:27:54</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>1</revnumber><date>2005-11-29 02:17:04</date><authorinitials>MichaelOlson</authorinitials><revremark>Migrate from old wiki.</revremark></revision></revhistory></articleinfo><para>This page contains example scripts for automating the process of giving <ulink url="https://wiki.hcoop.net/FeedingSpamAssassin/SpamAssassin#">SpamAssassin</ulink> feedback. </para><section><title>Warning</title><para>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. </para></section><section><title>Scripts</title><para><emphasis role="strong">feed-site-spam</emphasis>: Feed uncaught spam messages to <ulink url="https://wiki.hcoop.net/FeedingSpamAssassin/SpamAssassin#">SpamAssassin</ulink>. </para><para><emphasis role="strong">NOTE</emphasis>: It is assumed that you empty your Spam folder after running this script.  Otherwise you'll feed some of the same messages to <ulink url="https://wiki.hcoop.net/FeedingSpamAssassin/SpamAssassin#">SpamAssassin</ulink> every time you run the script. </para><screen><![CDATA[# Location of your spam directory
SPAMDIR=~/Maildir/.Spam.Definitely/cur
]]><![CDATA[
# Destination directory for spam messages
#SHAREBASE=/etc/spamassassin  # an older instance
SHAREBASE=~spamd    # current name circa 1/2010
SHAREDDIR=$SHAREBASE/Maildir/.SiteSpam/cur
]]><![CDATA[
# 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]]></screen><para><emphasis role="strong">feed-site-ham</emphasis> </para><screen><![CDATA[# Prefix for folder locations
MAILPRE=~/Maildir/.
]]><![CDATA[
# IMAP directories that contain definite non-spam (ham)
HAMDIRS="Bugs Family Friends Fun Gnu Info Lists Plug School Work"
]]><![CDATA[
# Destination directory for ham messages
#SHAREBASE=/etc/spamassassin   # an older instance
SHAREBASE=~spamd     # current name circa 1/2010
SHAREDDIR=$SHAREBASE/Maildir/.SiteHam/cur
]]><![CDATA[
# 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]]></screen><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/FeedingSpamAssassin/CategoryOutdated#">CategoryOutdated</ulink> <ulink url="https://wiki.hcoop.net/FeedingSpamAssassin/CategoryMemberManual#">CategoryMemberManual</ulink> </para></section></article>