RE: [Exim] how to rewrite

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Eli
Data:  
Para: 'Exim-users'
Asunto: RE: [Exim] how to rewrite
Fred Viles <> wrote:
> On 10 Feb 2004 at 20:10, Michael Johnson wrote about
>     "[Exim] how to rewrite":

>
>> ...
>> I want to take a header from an incoming message, and copy the header
>> to a different header with a different name. For example, take the
>> "List-Post: address@???" header and copy the entry to give me
>> "Reply-To: address@???". I suppose the rewrite should also
>> check to see if there's already a Reply-To header. I suppose that
>> part could get to be quite tricky.
>
> How about this (untested), added to the appropriate router(s):
>
>   headers_add    = ${if and { \
>             { !def:header_Reply-to: } \
>             { def:header_List-Post: } \
>               }    { Reply-To: $header_List-Post: } {} }


That's not really a rewrite, but just adding another header (no idea what
would happen if you had multiple reply-to headers... I assume the mua would
take all of them to form the To: field).

If you wanted to rewrite the reply-to header, but also preserve it, you will
have to preserve it first. This is where I'm not sure if it will work out.
I don't remember of the rewriting (the rewrite section in exim) is done
before or after ACL stage - or even router stage (I'd assume it would have
to be done before transport stage?). In either case, it would be something
similar to this *snippet*:

X-Reply-To-Was: $header_reply-to:

Use that in an ACL warn message combo, or if it can be done at router time,
use headers_add (or is it header_add?).

Once you have that, you can use exims rewrite section to rewrite the
reply-to field:

   *            $rheader_list-post:          r


However, watch out with that as it will rewrite ALL your messages. The
first * is what it will be matching against in the header you are rewriting
(in this case reply-to, denoted by the ending "r"). This means at most you
could only limit reply-to rewriting based on what is in the reply-to header
to begin with.

Maybe a better solution would be to use a system filter where you can do
header manipulation in running order, so you can add the X-Reply-To-Was
header copying the reply-to header, then remove the reply-to header, then
add the reply-to header newly formed based on the list-post header - but,
I'm not going to delve into that since learning on your own is fun, and
because you asked only how to use rewriting (I love taking things too
literally!) :P

Eli.