Re: [EXIM] Remove attachments

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Marc Haber
CC: exim-users
Sujet: Re: [EXIM] Remove attachments
On Mon, 7 Jun 1999, Marc Haber wrote:

> >What you can see is in $message_body and is the first part of the body.
> >You really can't do this in a system filter, you might be able to do it
> >in perl.
>
> And how do I invoke that perl script? I don't see a way to do so as in
> a system filter. And that system filter has only access to
> $message_body. Am I missing something here?


if "${perl{somefunction}{$message_id}}" is "fail it" then
fail text "I don't like this message"
else
headers remove "appropriate:headers:for:attachments"
headers add "X-I-Have-Removed-Any-Attachments: signed Exim"
endif

The perl script takes the message id and uses it to look at the spool
file containing the message body (the -D file) directly. At the time
this is run, the -D file is open and locked, so you must modify it in
place if that is what you want to do - but removing attachments is
presumably a simple truncation. You should not modify the -H file,
because the headers are in main memory at this point.

I have not tried this, and it is a bit (well, rather) hairy, but I don't
see why it shouldn't work. For more efficiency the whole filter thing
should probably be wrapped inside a test for $h_content-type: defining a
boundary for the attachments, to save running Perl for messages without
any attachments.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.



--
*** Exim information can be found at http://www.exim.org/ ***