Re: [EXIM] rewrite/${if match problem

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Peter Radcliffe
CC: exim-users
Sujet: Re: [EXIM] rewrite/${if match problem
On Mon, 15 Dec 1997, Peter Radcliffe wrote:

> Yes, but if I have:
>
> rewrite From: line
> rewrite envelope from, using $header_from:


*How* do you have that? The order of rewriting is undefined (as I said).
There is no guarantee that it will rewrite the From line before it
rewrites the envelope from line, and in fact in the present
implementation it does the envelope rewriting before the headers
rewriting.

Ah. I think I see the misconception, and I guess it's my fault for not
making it clear in the documentation. The order of the rewriting rules
does not imply that rewriting takes place in the order that might be
implied by looking at the flags (if indeed it is possible to define a
unique order that way). For each rewriting instance, those rules that
apply are applied in order, but that is all.

> If either $header_from: was changed after the rewrite or $header_from:
> was qualified (but then this may not be the origional header),


Both of these happen as a result of the rewrite, but it happens after
the envelope rewrite.

> or there was
> a flag to qualify unqualified addresses that result from rewrites


That could be done. I have put the suggestion on the wish list.

> Is there any way to get access to the qualified version of $header_from:
> or a way to automaticly qualify an unqualified address in a rewrite rule ?


Unfortunately at the moment, no, except by complicating the rewriting
string. For example if your original rule was

user@domain     X    flags


then you could replace X with

    ${if match{X}{^([^@]+)(.*)} \
    {${if eq{$2}{}{$1@$qualify_domain}{$1$2}}}


which will look horrendous, since your X is pretty complicated. The
first line of that should always match, putting anything before an @ in
the address into $1, and the rest into $2. The second line then adds a
qualification if there isn't one. I have not tested this - it is off the
top of my head.

> > You can always turn "rmail" into a script that calls Exim with the
> > options of your choice.
>
> Yes, but then there is an extra shell instance floating around for each
> mail that is sent. Not a great hardship, but not optimal.


Not if you end the script with "exec".

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***