[Mimedefang] Feature request: pass/warn/reject

Kris Deugau kdeugau at vianet.ca
Thu Jun 23 14:13:38 EDT 2005


"Dale J. Chatham" wrote:
> I have been using MIMEDefang with SpamAssassin  for several years and
> am quite pleased with the product.
> 
> In every installation, I've been asked to divide incoming mail into
> three categories:
> 
> 1. Pass (probably not spam)
> 2. Warn (might be spam)
> 3. Fail (almost certainly spam)
> 
> Currently, MIMEDefang directly supports only two levels, pass/fail.

Mmm.  Strictly speaking, MD supports an infinite number of levels of
classification.  Out of the box, messages are either tagged or not; 
you're free to add as many new classes as you like.  (IE, messages
scoring under 4 have no SA information added;  messages between 4 and 7
get a header warning, and messages over 8 get a subject tag.)

The same applies to anything calling SA;  while SA itself does have
options for tagging mail that goes over the threshold, the calling tool
is free to use the information SA returns to make additional decisions
about whether the message is definitely spam, probably spam, maybe spam,
etc.

For instance, I've long had procmail rules set up to file messages
scoring over 15 in a "big-spam" folder;  messages betwee 5 and 15 get
filed in the "spam" folder, and everything else ends up in my inbox.

> While I can code up (and have) in mimedefang-filter what is necessary
> to make this happen, reports don't reflect the three states.
> 
> This would seem to be a no-brainer.

I'm not sure what you think is missing from mimedefang-filter.  I could
easily include 3-level classification on one server calling SA from MD
something like this:

if (-s "./INPUTMSG" < 120*1024) {
  my($hits, $req, $names, $report) = spam_assassin_check();
  my($score);
  action_change_header("X-Spam-Score", "$hits, req=$req; $names");
  if ($hits >= 8) {
    action_change_header("Subject", "SPAM: $Subject");
  } elsif ($hits >= 4) {
    action_add_header("X-Spam-Status", "Probable");
  }
}

Mail scoring over 8 gets a subject tag;  mail between 4 and 8 gets an
X-Spam-Status header saying "Probable".  You could change that to a
subject alteration as well if you wanted.

The default SA report has two states;  but there's nothing forcing you
to use it.  You can create your own report:

if ($hits >= 8) {
  action_add_part($entity, "text/plain", "-suggest",
	"This message is almost certainly spam:\n$report\n",
	"SpamAssassinReport.txt", "inline");
} elsif ($hits >= 4) {
  action_add_part($entity, "text/plain", "-suggest",
	"This message may be spam:\n$report\n",
	"SpamAssassinReport.txt", "inline");
}

(I don't know offhand what might show up in $report;  you'd probably
want to reconstruct it yourself to better meet your needs.)

Calling spamassassin or spamc from procmail should provide you with an
X-Spam-Score header, and IIRC an X-Spam-Level header as well (containing
a number of stars roughly equal to the spam score).  That's what I use
on my own accounts to file high-scoring spam separately.

-kgd
-- 
Get your mouse off of there!  You don't know where that email has been!



More information about the MIMEDefang mailing list