[Mimedefang] Re: Automatically save spam/ham?

Ken Morley ken at jmtg.com
Thu Apr 15 08:26:30 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.).


Thanks for the great suggestion, Jeffrey.

I added the following to sub filter_end() in mimedefang-filter:
            # Modification to bcc known HAM/SPAM to appropriate corpus
            # Sendmail aliases file controls path to local file

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


I added the following to aliases:
		local-ham-archive:      /etc/mail/spamassassin/corpus/ham
		local-spam-archive:     /etc/mail/spamassassin/corpus/spam


This works as I requested (be careful what you wish for), but it puts all
spams in a single file called "spam".  I was hoping to build a corpus of
seperate files named with the message ID or some other unique identifier.
That would let me maintain a "current" corpus, by automatically deleting
older files, etc.  Also, I don't know whether sa-learn will work with
multiple messages in a single file.  Finally, I would prefer the message get
saved without the SpamAssassin.txt attachment - this method includes
everything.

Any other ideas?

Thanks again for your suggestions!

Ken Morley



More information about the MIMEDefang mailing list