Re: [Exim] Questions using transport filter

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Kirill Miazine
Fecha:  
A: Tim Tassonis
Cc: Patrice Fournier, exim-users
Asunto: Re: [Exim] Questions using transport filter
* Tim Tassonis <timtas@???> [20020409 11:43]:
> Thanks a lot for your quich reply. But I have some open questions:
>
> > > - If no, is there another way to call an external progam for all
> > > outgoing mail deliveries?
> >
> > Exim 4. :)
> >
> > If you can't upgrade, you can use a router like:
> >
> > encrypt_router:
> > condition = "${if eq {$received_protocol}{encrypted} {0}{1}}"
> > driver = domainlist
> > route_list = "*"
> > transport = encrypt_transport
> > errors_to = postmaster
> >
> > and set an encrypt_transport according to your need (see the pipe
> > driver). The command you will call in that transport will need to pass
> > the message back to exim with protocol encrypted (-oMr encrypted).
> > Search for amavis and/or SpamAssassin for examples of such setups (I'm
> > not sure there are routers examples for SpamAssassin but there are for
> > amavis).
>
> I'm not sure if I understand this right. When will this condition be
> matched? I have to call my programm for every outgoing mail there is. It's
> not clear to me who sets the value for $received_protocol to encrypted and
> under what circumstances. If it is set if the mail is sent/received using
> TLS, this would be the wrong approach.
>
> On a second note: if it makes it easier I might also switch to Exim 4. I
> checked the online documentation, but didn't find anything appropriate
> there as well. Can you give me a hint how it is done in exim 4 and what to
> look for in the documentation?


This can be easily done with Exim 3. Use system filter.

#check if this message has already been processed
if not first_delivery then
    finish
endif
#send the message to your program if it hasn't been so yet
if $received_protocol is not "foobar" then
    pipe "/your/program $sender_address $recipients"
endif


/your/program does whatever it wants with the message (it gets sender
and recipient addresses passed as arguments) and then reinjects the
message to Exim with by calling 'exim -oMr foobar'

--
Kirill