<?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>MemberManual/Email/SpamAssassin</title><revhistory><revision><revnumber>16</revnumber><date>2018-05-06 17:53:13</date><authorinitials>ClintonEbadi</authorinitials><revremark>remove some old cruft about shared-folder (create-user will create them now, and mire migration finished a decade ago). still needs work.</revremark></revision><revision><revnumber>15</revnumber><date>2013-01-14 09:13:53</date><authorinitials>ClintonEbadi</authorinitials><revremark>cat</revremark></revision><revision><revnumber>14</revnumber><date>2013-01-08 20:31:43</date><authorinitials>ClintonEbadi</authorinitials><revremark>copy the example exim filter in line</revremark></revision><revision><revnumber>13</revnumber><date>2008-07-07 04:27:49</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>12</revnumber><date>2007-12-18 01:09:27</date><authorinitials>AdamChlipala</authorinitials><revremark>Bad link</revremark></revision><revision><revnumber>11</revnumber><date>2007-12-15 17:30:11</date><authorinitials>AdamChlipala</authorinitials><revremark>members2 -&gt; members</revremark></revision><revision><revnumber>10</revnumber><date>2007-12-09 01:17:18</date><authorinitials>MichaelOlson</authorinitials><revremark>Add section for removing old spam training data</revremark></revision><revision><revnumber>9</revnumber><date>2007-12-02 20:25:38</date><authorinitials>FrankBynum</authorinitials></revision><revision><revnumber>8</revnumber><date>2007-11-27 16:15:23</date><authorinitials>pod1-4.cs.purdue.edu</authorinitials><revremark>Mention proper contents of shared-folders file --mwolson</revremark></revision><revision><revnumber>7</revnumber><date>2007-11-09 06:14:22</date><authorinitials>RyanMikulovsky</authorinitials><revremark>nevermind about request for clarification.</revremark></revision><revision><revnumber>6</revnumber><date>2007-11-09 06:09:11</date><authorinitials>RyanMikulovsky</authorinitials><revremark>add request for clarification of SpamAssassin shared folders</revremark></revision><revision><revnumber>5</revnumber><date>2007-11-04 22:59:50</date><authorinitials>AdamChlipala</authorinitials></revision><revision><revnumber>4</revnumber><date>2007-11-01 21:47:37</date><authorinitials>MichaelOlson</authorinitials><revremark>Move ntk's example to EximFilter page</revremark></revision><revision><revnumber>3</revnumber><date>2007-11-01 21:32:12</date><authorinitials>MichaelOlson</authorinitials><revremark>Fix logfile path</revremark></revision><revision><revnumber>2</revnumber><date>2007-11-01 20:52:14</date><authorinitials>MichaelOlson</authorinitials></revision><revision><revnumber>1</revnumber><date>2007-11-01 20:49:29</date><authorinitials>MichaelOlson</authorinitials><revremark>Initial contents</revremark></revision></revhistory></articleinfo><para>This page describes how to use SpamAssassin to keep junk email under control. </para><section><title>Introduction</title><para>You will probably want to set up SpamAssassin to detect junk e-mail for you.  <ulink url="http://spamassassin.org/">SpamAssassin</ulink> is a program for categorizing e-mail as spam based on a wide range of criteria. It indicates its decisions by adding special headers to messages. </para><para>Please note that we will never reject any spam email before it hits your filtering rules.  It is up to you to decide how to classify the email that hits your inbox. </para></section><section><title>Enabling spam detection</title><para>We use a custom tool called <code>setsa</code> to determine whether your email should be run through SpamAssassin.  To enable SpamAssassin for mail to your UNIX account, run </para><screen><![CDATA[setsa on]]></screen><para>To later disable it, run </para><screen><![CDATA[setsa off]]></screen><para>To check whether you've enabled it or not, run </para><screen><![CDATA[setsa]]></screen><para>You can similarly enable or disable SpamAssassin for a virtual mailbox address by adding it as the first argument to <code>setsa</code>; for example, <emphasis role="strong"><code>setsa user@domain.com on</code></emphasis> enables SpamAssassin for <code>user@domain.com</code> if you have <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/DomTool#">DomTool</ulink> permissions for <code>domain.com</code>. </para><para><emphasis role="strong">Please don't enable this if you can't commit to following the training procedure below when SpamAssassin makes an incorrect classification!</emphasis>  SpamAssassin makes small mistakes over time, and this can interact poorly with its automatic learning of which message properties signify spam.  If you don't correct its small misclassifications, then these increase the chance of misclassifying future messages, which itself leads to more faulty learning, vicious cycle style. </para></section><section><title>Moving spam email to a different folder</title><para>The above procedure only asks SpamAssassin to examine your mail and add extra headers indicating its verdict, spam or legit.  To use these headers to move junk mail to a folder called Spam in your IMAP mailbox, copy the following template to <code>~/.public/.forward</code>.  This is an Exim filter that looks for SpamAssassin headers that indicate spamhood.  You need to create a Spam folder manually to use this.  You can modify this template to save spam to other places, if you don't use IMAP or prefer another scheme.  (If you already have a <code>~/.public/.forward</code> file because you forward all of your mail to another account elsewhere, then you can ignore this section. You should use that e-mail provider's spam filtering services.) </para><screen><![CDATA[# Exim filter
]]><![CDATA[
logfile $home/.logs/mail/exim.log
]]><![CDATA[
if
    "${if def:h_X-Spam-Flag {def}{undef}}" is "def"
then
    save $home/Maildir/.Spam/
    finish
endif]]></screen><para>SpamAssassin flags spam with a spamminess level of 5.0 or higher.  You can use the X-Spam-Level: header to customize your own filter to your own liking, however.  As an example, you can see <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/NathanKennedy#">NathanKennedy</ulink>'s .forward file on the <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/MemberManual/Email/EximFilter#">MemberManual/Email/EximFilter</ulink> page. </para></section><section><title>Training</title><para>One way that SpamAssassin spots spam is by using statistical (Bayesian) analysis.  This requires lots of training data to work properly. </para><para>Sometimes this analysis will make mistakes, and you'll want to perform the electronic equivalent of slapping it with a newspaper.  The way to do that is to deposit misclassified mail in special system-wide IMAP folders, one called <code>SiteSpam</code> for spam that SpamAssassin missed and one called <code>SiteHam</code> for good messages that were erroneously marked as spam. </para><para>If you ever run into this situation, here's how you can feed our system-wide trainer: </para><orderedlist numeration="arabic"><listitem><para>First, this is only going to work if you are using IMAP (our webmail is using IMAP, so that can be used).  If you're not, or if you have other sources of spam or ham that you'd like handled specially, place a support request on <ulink url="https://members.hcoop.net/">the portal</ulink>. </para></listitem><listitem><para>Use your IMAP client's &quot;subscribe&quot; feature to subscribe to <code>SiteSpam</code> and/or <code>SiteHam</code>, which should appear in the <code>SpamAssassin</code> mailbox inside the <code>shared</code> tree.  If you don't see the <code>shared</code> tree, then file a support request. </para></listitem><listitem><para>When you want a message to be used as an example of spam or ham, place a copy of it in the appropriate folder. </para></listitem><listitem><para>Every five minutes, our faithful spamhound will sniff these folders, update its data, and clear their contents. </para></listitem></orderedlist><para>If you would like to automate this process somewhat, check out <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/FeedingSpamAssassin#">FeedingSpamAssassin</ulink>.  For the curious and the sysadmins out there, <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/SpamAssassinAdmin#">SpamAssassinAdmin</ulink> gives more details on how we set this up. </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/CategoryMemberManual#">CategoryMemberManual</ulink> <ulink url="https://wiki.hcoop.net/MemberManual/Email/SpamAssassin/CategoryNeedsWork#">CategoryNeedsWork</ulink> </para></section></article>