[Mimedefang] filter based on From/To headers?

Damrose, Mark mdamrose at elgin.edu
Mon May 10 14:33:12 EDT 2004


> -----Original Message-----
> From: Kelsey Cummings [mailto:kgc at sonic.net]
> Sent: Monday, May 10, 2004 1:01 PM
> To: mimedefang at lists.roaringpenguin.com
> Subject: Re: [Mimedefang] filter based on From/To headers?
> 
> 
>  The only thing I can figure now is 
> that the HEADERS
> file isn't getting flushed to (ram)disk when it's created.


> Yet:
> 
> for dir in `ls`; do find $dir -type f | grep new | xargs grep \
>  '^\(To\|From\)' | grep mx.sonic.net > /tmp/mx_in_header.$dir & done
> 
> results in:
> 
> ...
> a/n/XXX/new/1084194436.30315_0.a.lds,S=3595:From: 
> Marianne.Walters at a.mx.sonic.net
> a/s/XXX/new/1084194432.30081_0.a.lds,S=4152:From: 
> Marianne.Walters at a.mx.sonic.net
> b/a/XXX/new/1084204421.9158_0.a.lds,S=13680:From: "arthur" 
> <"arthur"@b.mx.sonic.net>
> b/a/XXX/new/1084198291.29385_0.a.lds,S=12729:To: 
> undisclosed-recipients at b.mx.sonic.net
> b/a/XXX/new/1084198480.3495_0.a.lds,S=11911:To: 
> undisclosed-recipients at b.mx.sonic.net
> ...

Are you sure they all have the hostname at the point MD sees them?
Could your sendmail be re-writing e.g.
to: undisclosed-recipients
as
to: undisclosed-recipients at b.mx.sonic.net
after MD returns?

Look for 
FEATURE(always_add_domain)dnl
in sendmail.mc.  If you don't have clients that require this, perhaps
you could remove it.  

And/or try
   if ( open(HEADER, "<HEADERS") )
   {
        while(<HEADER>)
        {
                next unless /^(To|From|Cc):/i;
                unless ( /\@/ )
                {
                        md_syslog('err',"found unqualified username in
header:: $_");
                        next;
                }
                if ( /mx\.sonic\.net/i )
                {
                        md_syslog('err',"found hostname in header:: $_");
                }
        }
        close(HEADER);
   }
   else
   {
        mdsyslog('err',"couldn't open HEADERS for hostname information ::
$!\n");
   } 



More information about the MIMEDefang mailing list