[Mimedefang] Automatically save spam/ham?

Jeffrey Goldberg jeffrey at goldmark.org
Wed Apr 14 13:01:19 EDT 2004


On Wed, 14 Apr 2004, Ken Morley wrote:

> I would like to automatically save samples of spam and ham in a directory on
> the SA/MIMEDefang server.
>
> Specifically, when SA/MIMEDefang encounters a message with a score less than
> 0.5, I would like to save a copy in /etc/mail/spamassassin/corpus/ham.  When
> the score is above 6.0, I would like to save a copy in
> /etc/mail/spamassassin/corpus/spam.  In both cases, I would let the original
> message continue to be processed as usual (ie: sent to the user, etc.).

Someplace in filter_end() there will be something like

  my($hits, $req, $names, $report) = spam_assassin_check();

After that, use the "$hits value for your tests, so

  something like

   add_recipient('local-ham-archive at mydomain.example') if ($hits <= 0.5);
   add_recipient('local-spam-archive at mydomain.example') if ($hits >= 6);

add_recipient() is like adding a Bcc to a message.  It won't show up in
the headers, but will be delivered to the additional address.

And create aliases like

  local-ham-archive:  /etc/mail/spamassassin/corpus/ham
  local-spam-archive:  /etc/mail/spamassassin/corpus/spam

Note that you should be aware that if spammers discover those addresses
they can mail to them to manipulate your corpuses.  I believe that there
is some sendmail trick to make some addresses usable only for mail
generated locally, but I don't know what that trick is.

-j

-- 
Jeffrey Goldberg                            http://www.goldmark.org/jeff/
 Relativism is the triumph of authority over truth, convention over justice
 Hate spam?  Boycott MCI! http://www.goldmark.org/jeff/anti-spam/mci/



More information about the MIMEDefang mailing list