[Mimedefang] Small Assistance

Jim McCullars jim at info.uah.edu
Tue May 13 16:10:01 EDT 2003


On Tue, 13 May 2003, John wrote:

> My wish is to: After SpamAssassin processes the mail and returns a score,
> if any of the recipients is mine (john at jjgb.com) or my wifes
> (gloria at jjgb.com), I want to reject (bounce) that message.  The way I read

   Something like this should do.  Right after:

my($hits, $req, $names, $report) = spam_assassin_check();
  if ($hits >= $req) {
    md_log('spam', $hits, $RelayAddr);

add this:

  my $recip;
  foreach $recip (@Recipients) {
    if($recip =~ /john\@jjgb\.com/i || $recip =~ /gloria\@jjgb\.com/i) {
      return action_bounce("Invalid content")
    }
  }


and if it's not you or your wife, it should just fall through to the part
that tags it as spam.  Note that with this approach, if a message comes in
with multiple recipients and you happen to be one of them, if SA tags it
as spam, it's gone.  If that is a concern, you may need to look in to
stream_by_recipient.  Another approach (and this is, as David calls it,
Untested Perl Code While Replying To Email(TM)) might be something like
this:

# msg has been tagged as spam....decide on disposition
   my $recipcount = @Recipients;     # how many recipients for this msg
   if ($recipcount == 1) {           # just one?
     if (@Recipients =~ /john\@jjgb\.com/i ||  # is it me...
         @Recipients =~ /gloria\@jjgb\.com) {  # or the missus?
       return action_bounce("Invalid Content");  # yes, reject
     }
   }
#  not mine, just tag it

   I think that should work.  I think  :-)

   HTH...

Jim





More information about the MIMEDefang mailing list