Re: [exim] Very Advanced Address Rewriting

Top Page
Delete this message
Reply to this message
Author: Tony Finch
Date:  
To: Steffen Heil
CC: exim-users
Subject: Re: [exim] Very Advanced Address Rewriting
On Mon, 17 Jul 2006, Steffen Heil wrote:
>
> verb_router:
> driver = redirect
> condition = ${if match {${lc:$sender_address $local_part@$domain}} {\N^(.*)-recipient@(.*) (\d*)-(.*)@(.*)$\N} }
> data = ${if match {${lc:$sender_address $local_part@$domain}} {\N^(.*)-recipient@(.*) (\d*)-(.*)@(.*)$\N} {$4@$5} }
> errors_to = ${if match {${lc:$sender_address $local_part@$domain}} {\N^(.*)-recipient@(.*) (\d*)-(.*)@(.*)$\N} {$1-$3@$2} }
>
> AFAIK, this shoud rewrite
> sender-recipient@??? => 123-local@???
> to
> sender-123@??? => local@???
>
> Allowing me to send multiple RCPTs with different "number-email" pairs...


Why the numbers instead of normal VERP syntax?

> (And any way to prevent using the same regexp 3 times? I tried with data =
> $4@$5 only, but this gave me errors.)


The way you want to transfer data from the recipient address to the sender
address makes this very hard to do nicely. With a more normal VERP you
could say:

verp:
driver = redirect
senders = *-recipient@???
data = $local_part@$domain
errors_to = $sender_address_local_part=$local_part%$domain@$sender_address_domain

Hmm. I suppose you can play tricks with address_data, but it doesn't
improve things much.

verp:
  driver = redirect
  address_data = ${if match{$sender_address $local_part@$domain} \
                           {\N^(.*)-recipient@(.*) (\d*)-(.*)@(.*)$\N} \
                      {slp=$1 sd=$2 num=$3 rlp=$4 rd=$5} }
  data      = ${extract {rlp} {$address_data} }\
             @${extract {rd}  {$address_data} }
  errors_to = ${extract {slp} {$address_data} }\
             -${extract {num} {$address_data} }\
             @${extract {sd}  {$address_data} }


Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}