Re: [exim] Re: Errors in transport filters

Página Inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
Para: Felix Schwarz
CC: exim-users
Assunto: Re: [exim] Re: Errors in transport filters
On Thu, 8 Dec 2005, Felix Schwarz wrote:

> My script does not send any mails. It is just a filter that changes a mail in
> certain way. After that the output (RFC 822 email) should be handed over to
> Exim again. Exim will handle the actual delivery.
>
> What Exim does is: It takes the mail, calls the transport filter script. This
> script will return a non-zero exit code and (as a savety measure) will return
> the original email without any changes. Exim will take that mail and deliver
> it. *Additionally* the original mail will stay in the queue and the queue
> runner will try to deliver it on the next run.


That seems to be exactly in accordance with Exim's specification. A
non-zero return from a transport filter is a failure; Exim thinks the
delivery has failed, so it tries again later. It cannot tell that what
appears to it to be an entirely different message that has been
submitted is in fact the same message again. You can't be "returning"
the original mail. There's no way to do that. You are submitting another
message. I assume you are using a pipe transport with options such as

use_bsmtp
command = /usr/sbin/exim -oMr scanned -bS
transport_filter = /your/script

If there is any possibility of /your/script not passing through the
entire message, this is not straightfoward. Transport filters are not
supposed to fail. The script could perhaps buffer the message in
memory, and then either write it all out and return zero, or write out
nothing (so no message is submitted) and return non-zero (so Exim tries
again later).

Actually, now I think about it, if -bS is used, a partially written
message will just give rise to an error; IIRC, Exim complains if it
doesn't receive an entire -bS message. This is different from a
non-BSMTP command-line submission, where the end of file is the end of
the message.

But the bottom line is: if you pass the message to Exim as a new message
for delivery, then you must return zero to tell Exim not to deliver the
original message again.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book