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

Top Page
Delete this message
Reply to this message
Author: Jürgen Edner
Date:  
To: exim-users
Subject: [exim] how to make use of custom variables in a router
Hello,
I just want to setup a router which switches to the maildir format,
if two directories exist in the destination directory. I've set-up
the following router which works very well:

public_folder_maildir:
  driver    = accept


  condition = ${if exists{/home/public/.${extract{folder}
                {${lookup{$local_part}lsearch{/etc/pubfolders}}}
                {$value}}/cur}}
  condition = ${if exists{/home/public/.${extract{folder}
                {${lookup{$local_part}lsearch{/etc/pubfolders}}}
                {$value}}/new}}


transport = public_folder_maildir_delivery

To speed-up the process I want to run the lookup-process only once
and store the lookup result in a custom variable, like this:

  ...
  set = r_dir = ${extract{folder}{${lookup{$local_part}
                  lsearch{/etc/pubfolders}}}{$value}}
  condition = ${if exists{/home/imappublic/.$r_dir/cur}}
  condition = ${if exists{/home/imappublic/.$r_dir/new}}
  ...


I'm not sure if I'm using the correct set-syntax. I've read the
documentation and searched the internet but couldn't find an
example which shows the correct command usage. It would be nice
if someone can shed some light on the syntax and maybe can
provide and example.

Thanks in advance!

Regards
Juergen