Re: [exim] Re: Errors in transport filters

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Felix Schwarz
CC: exim-users
Tárgy: Re: [exim] Re: Errors in transport filters
On Thu, 8 Dec 2005, Felix Schwarz wrote:

> Sorry for my wording. I used the phrase "original mail" in two different
> meanings. Your description matches exactly what I want to achive. After the
> transport filter failed the message should stay in the queue. I only want to
> eliminate the "extra mail" which is made of the output of the failed transport
> filter..


I made two suggestions about how you might do that:

1. Buffer up the message in the transport filter, and produce no output
until you are sure it is not going to fail. [But see below.]

2. Use batch SMTP format (-bS); in that case, if the transport filter
does not send a complete message to Exim on its output, Exim will
generate an error and not create a new message.

> > Transport filters are not supposed to fail.
>
> That is maybe the key sentence but I did not find this in your book although I
> thought that I read the pages 161-164 quite carefully.


In the manual (not the book) it does say "The command should normally
yield a zero return code." I will add "Transport filters are not
supposed to fail." just to make it absolutely clear. If there is ever a
new edition of the book, I will improve the wording there too.

> The thing is that Exim will send a mail every time independent from
> the exit code returned by the transport filter. If the exit code is
> non-zero, the mail will stay in the queue additionally. But Exim will
> send a mail even if there was no output at all. In this case the body
> of the mail sent will be empty.


Yes, that's true, because you have specified the recipients on the
command line. That is exactly in accordance with the spec. You need to
use -bS in order to be able to abandon a submission from the command
line.

My apologies. Suggestion 1 above won't work.

> As I see it there is currently no possibility that the transport filter can
> fail without sending an additional mail as the new exim instance will be
> invoked at the same time (in parallel) to the transport filter script and this
> new instance does not know anything about the transport filter, exit codes
> etc.


As I see it, the only possibility in the current way you are doing
things is if you use -bS.

However, you could completely revise the way you do things. Pipe
directly to your script, without using a transport filter. Buffer up the
message in main memory (or in a file if you want) until you are sure you
are not going to fail. Then run a new command from the script to
re-submit the message.

-- 
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