[Mimedefang] custom function - stripping attachments based on headers

Terry Davis tdavis at approbation.org
Wed May 1 02:48:48 EDT 2002


Ahhhh

after much beating and screaming and yelling, I got something to work.  
1) You must restart sendmail/mimedefang to see changes to the config
file (duh)
2) Make sure your regex is reality-compliant
3) Try to be simple

here is what I am doing:

    open( HDRS, "<HEADERS");
    while( $line = <HDRS> ) {
            chomp $line;
            open( F, ">>/tmp/foob");
           if ( "$line" =~ /To:.*tdavis\@domain\.com/ || "$line" =~
/for.*tdavis\@domain\.com/ ) {
                print( F "$line\n");
                close ( F );
            }
        print( F "$line\n");
        close ( F );
    }
    close(HDRS);


One thing I am noticing that I still have a question about is I see no
'To:' header.  I see one in the HEADERS file for the emails that have
'viruses' in them.  Why not in what I am looking at ?

Thank you for your help everyone!



On Tue, 2002-04-30 at 10:13, David F. Skoll wrote:
> On 30 Apr 2002 00:37:12 -0500 Terry Davis <tdavis at approbation.org> wrote:
> 
> > I want strip out attachments from emails based on the TO and FROM
> > headers and run a script with the headers and attachment(s) as
> > arguments.
> 
> The message headers are in "./HEADERS"
> 
> So:
> 
> open(HDRS, "<HEADERS");
> while(<HDRS) {
>         chomp;
>         # Do something with header
> }
> close(HDRS);
> 
> Also, the HEADERS file has the headers "unfolded", so you're guaranteed
> that each line in the file is a single complete header.
> 
> Regards,
> 
> David.
> 
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
-- 
Terry Davis
http://approbation.org/




More information about the MIMEDefang mailing list