[Mimedefang] filter-question

Jason Englander jason at englanders.cc
Mon Apr 14 11:59:01 EDT 2003


On Mon, 14 Apr 2003, [iso-8859-1] Per Björklund wrote:

> For example the spamassassin and mimedefang mailinglist (since they
> sometimes contains spamexamples)?  I'm a bit confused how I can find
> those adresses so I could make something like this:
>
>  if !($to = "mimedefang\@lists.roaringpenguin.com") {

You could use the envelope sender address ($Sender):

  my $sender = lc($Sender);
  $sender =~ tr/<>//d;
  if ($sender ne 'mimedefang-admin at lists.roaringpenguin.com' &&
      $sender ne 'spamassassin-talk-admin at lists.sourceforge.net') {

or the subject ($Subject):

  if ($Subject !~ /\[Mimedefang\]/ && $Subject !~ /\[SAtalk\]/) {

or the To: or Cc: header - but I'd say this one would be the worst method
to use.  It would match if the MD or SA mailing list addresses show up in
any To or Cc address, but if the message was Bcc'd to the list it wouldn't
match, if it was re-sent ("Bounce" in Pine) it wouldn't match - you'd have
to check the Resent-To and Resent-Cc headers also, not to mention the
added I/O of opening and parsing ./HEADERS for every e-mail that comes
through.

  my $CHECK_IT_WITH_SA = 1;
  open (HEADERS, "./HEADERS") || warn "$MsgID: Unable to open ./HEADERS";
  while (<HEADERS>) {
    if (/^(To|Cc):\s+/) {
      chomp;
      my @ToAddrs = Mail::Address->parse($_);
      foreach my $addr (@ToAddrs) {
        my $toaddr = lc($addr->address);
        if ($toaddr eq 'mimedefang at lists.roaringpenguin.com' ||
            $toaddr eq 'spamassassin-talk at lists.sourceforge.net') {
            $CHECK_IT_WITH_SA = 0;
            last;
        }
      }
    }
  }
  close (HEADERS);
  if ($CHECK_IT_WITH_SA == 1) {
    # Check it with SA
  }

> Are those addresses in the @recipients array or where can I find those?

The @Recipients array won't work because your e-mail address would be in
there, not the mailing list's address.

  Jason

-- 
Jason Englander <jason at englanders.cc>
394F 7E02 C105 7268 777A  3F5A 0AC0 C618 0675 80CA





More information about the MIMEDefang mailing list