Re: [exim] how to make use of custom variables in a router

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jürgen Edner
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] how to make use of custom variables in a router
Hi Jeremy,

> On 28/05/2020 11:54, J?rgen Edner via Exim-users wrote:
>> set = r_dir = ${extract{folder}{${lookup{$local_part}
>> ...
>
> An example of use in the Exim testsuite:
>
> alias:
>   driver =      redirect
>   debug_print = DEBUG: $r_r1 $r_r2
>   data =        b
>                 # r_r1 checks that a variable with tainted data is ok
>                 #       that the default list-sep ":" is not used for
> this list
>                 #       that an '=' on the RHS is ok
>   set =         r_r1 = <$local_part> aaa:bbb bar=baz
>                 # r_local checks that a variable is immediately usable
>   set =         r_local = check
>   errors_to =   bad_$r_local


thank you for providing that example, which confirms that I'm using
the correct command syntax in my router configuration. Nevertheless
the set command seems not to work as it should.

To debug the problem, I first tested if my lookup returns the expected
value by adding the following debug_print:

  debug_print = DEBUG: ${extract{folder} \
                      {${lookup{$local_part}lsearch{/etc/pubfolders}}} \
                      {$value}}


The output showed exactly what I had expected, so in a second step I
modified the commands as follows to assign the result to a variable.
(I added the first set-command to check if at least a static string
could be assigned to a custom variable):

  driver    = accept
  set = r_r1  = dumbo
  set = r_r2  = ${extract{folder} \
                 {${lookup{$local_part}lsearch{/etc/pubfolders}}} \
                 {$value}}
  debug_print = DEBUG: local_part=$local_part r_1=$r_r1 r_2=$r_r2


  -> Result: "DEBUG: local_part=my-pub-folder r_1= r_2="
                                                  ^^   ^^
Unfortunately both variables $r_r1 and $r_r2 seem not to be set at all.
I doesn't matter if I assign a static string like "dumbo" or if want to
assign a extraction/lookup result.


Do you have any other ideas what might cause the described problem?

BTW, I'm run my tests using the latest Exim version 4.93.0.4.

Thanks
Juergen
--
Mail: juergen.edner@???
GPG Key available