Re: [exim] Delting HTML attachments

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Cyborg
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] Delting HTML attachments
Am 05.04.2013 18:10, schrieb Graeme Fowler:
> On Fri, 2013-04-05 at 16:51 +0100, Mark Goodge wrote:
>> Exim's job as a Mail Transfer Agent is to transfer mail. The same
>> applies to every other MTA. It's what they're for.
>>
>> If you want a Mail Editing Agent, then these are available. Some of them
>> may even be available as an external filter through which an MTA, such
>> as exim, can pass mail.
> And this is exactly what the OP asked for.
>
> There are several ways to do it. In terms of decreasing "ease" (in my
> opinion) of application:
>
> 1. A transport filter applied at the mailbox delivery level, or
> 1a. A pipe transport to a script/program which strips the necessary
> content and delivers the message to the mailbox
>
> 2. A system filter applied to all messages which calls a pipe
>


I think, a Transport Agent should not be used to mess with mails beyond
the absolutly needed at smtp level ( like Spam/virus- rejects ).

This said,

1. define a router :

autoresponder:
driver = redirect
domains = +local_domains
condition = ${if </WHATSNEEDEDTOIDENTIFYIT/>}{yes}{no}}
data = /usr/sbin/htmlremover
allow_fail
allow_defer
no_verify
no_expn
check_ancestor
unseen
more
pipe_transport = address_pipe
reply_transport = address_reply
redirect_router = autoresponder

2.

/usr/sbin/htmlremover can be a bashwrapper for java or perl / php ,
whatever you like.

Take the data delivered via stdin : ( java )

static public void main(String[] args) {

                 try {


                         BufferedReader ins = new BufferedReader(new 
InputStreamReader( System.in ));
                         String lines   = "";
                         String output  = "";
                         while ((lines = ins.readLine())!=null) {


                                 If ( line_youMayPass ) 
output=doWhatYouNeed(lines);
                         }


     ....
     Message msg = new MimeMessage(session);
     ...
     msg.setContent(output,contentType);
     ....
     Transport.send(msg);


                 }
}


and send it to you again.. Don't forget to add a custom header, which
you use to bypass the router condition !

3. Job done, without messing in exim with your mailcontent.