Re: [Exim] .forward and pipe modified message

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Philip Hazel
日付:  
To: Dan Muey
CC: exim-users
題目: Re: [Exim] .forward and pipe modified message
On Wed, 3 Sep 2003, Dan Muey wrote:

> In a user's .forwadr file:
>
> #Exim Filter
> pipe "/path/to/mailfilter email@???"
>
> This will give the email for the user to STDIN of /path/to/mailfilter with email@??? as /path/to/mailfilter's argument?
> Correct?


Yes.

> So my question is if I exit(1); from /path/to/mailfilter (a perl
> script) then that tells exim that the pipe failed and the message goes
> to the black hole and is never heard from again, and if I exit(0);
> then it tells exim the pipe was successful and to continue on.
> Correct?


No. If you exit(1) Exim will assume the delivery failed, and will
generate a bounce to the sender. If you exit(0) without doing anything
with the message, you have blackholed it.

> Now the question is this:
>    How would I get Exim go ahead and deliver the message that /path/to/mailfilter creates instead
>    of the original message on an exit(0);?


Exim is delivering the original message to the pipe. That's all it
knows. You cannot, at this stage, tell it to deliver it anywhere else.
If you want Exim to deliver a new (modified) message, you must pass the
new message to a new instance of Exim. In other words, you submit a new
message. Alternatively, you can pass the message to a local delivery
agent such as procmail if all you want is a local delivery.

If you pass a new message to Exim there is a potential looping problem.
If you are doing this for unprivileged users, the best you can probably
do is to insert some kind of obscure header line that you test (and
remove) in the filter.


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