[Mimedefang] how to do perform spamassassin check for specific recipients

Martin J. Dellwo dellwo at 3dp.com
Fri Mar 12 16:19:00 EST 2004


I'm running MIMEDefang 2.40 and SpamAssassin 2.63.  For reasons I'd just 
as soon not waste bandwidth explaining, I'd like to perform SpamAssassin 
checks on mail containing two specific users as recipients (if others 
happen to be on the recipient list, it's ok).  Presumably I would modify 
  filter_end where SpamAssassin is already used in the example filter. 
How would I do this?  Presumably it involves the Recipients array... I'm 
guessing instead of
     if ($Features{"SpamAssassin"}) {
I would have
     if ($Features{"SpamAssassin"} && <something> ) {

perhaps this works?

     $doSA = 0
     foreach $chkrecip (@Recipients) {
           if ( $chkrecip =~ /^<?(user1|user2)>?$/i ) {
              $doSA = 1
              last
            }
     }
     return if !($doSA)  # $doSA = 0, skip the rest of filter_end
     if ($Features{"SpamAssassin"}) {
etc...

While I'm at it, I'd like to redirect mail to a single box if the SA 
score is above a certain level (I was thinking 12) so the user doesn't 
see it; also if the Recipients list contains certain blocked addresses, 
I'd like to add 1 to the score (but I already reject them in 
filter_recipient, so  are they gone from Recipients in filter_end??)
Perhaps something like this:

       foreach $chkrecip (@Recipients) {
             ++$hits if ( $chkrecip =~ /^<?(bad1|bad2|bad3)>?$/i
       }

This could be done after I've already done spam_assassin_check() and 
determined that $hits is not already > 12 or whatever my cutoff is for 
redirecting.

To redirect for $hits > some cutoff, would I do 
resend_message("highscoreuser");
but then what??  or would I replace all of @Recipients (how?)...

I'm not a real perl programmer, if that's not obvious from the above! ;)
-- 
Martin J. Dellwo
(610) 458-5264 x6512
mdellwo at prdus.jnj.com / dellwo at 3dp.com
Systems Administrator, 3DP


More information about the MIMEDefang mailing list