[Mimedefang] custom function - stripping attachments based on headers

Terry Davis tdavis at approbation.org
Tue Apr 30 15:05:41 EDT 2002


Thank you again for your help.
I am not able to get anything to work.
I have this at the beginning of my filter_begin:

        open(HDRS, "<HEADERS");
        while( $line = <HDRS> ) {
                chomp $line;
                %mail = ( To    => "tdavis\@domain.com",
                        From    => "test at domain.com>",
                        Subject => "filter thingy",
                        Message => "$line"
                );
                $mail{'Content-type'} = 'text/html';
                sendmail(%mail) or die $Mail::Sendmail::error;
        }
        close(HDRS);

This should give me an email for every line in the header of every email
that passes through mimedefang....correct?

Thank you for the ideas.




On Tue, 2002-04-30 at 11:18, David F. Skoll wrote:
> On 30 Apr 2002 10:42:13 -0500 Terry Davis <tdavis at approbation.org> wrote:
> 
> > I want it to work like such:
> > If mimedefang thinks it is a virus or spam, then do what it needs to
> > with it, if it makes it through those checks then I want it to go
> > through my little program if the headers match up to what I want...I
> > think I know how to go about all that except where to place this
> > function....
> 
> You can define the function anywhere in your filter file.  The filter
> file is just a chunk of Perl code which gets added to the main body
> of mimedefang.pl.  So you can do this in the filter file.
> 
> sub my_function {
>         my($arg1, $arg2) = @_;
>         # whatever
> }
> 
> sub filter {
>         # blah blah blah...
> 
>         if (my_function($entity, "foo")) {
>                 action_quarantine($entity, "my_function said so!");
>         }
>         # blah blah blah...
> }
> 
> You can even define external Perl files which are brought in with
> require.  You can build up a library of Perl filtering routines if
> you're ambitious. :-)
> 
> --
> 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