[exim] saving substr result?

Top Page
Delete this message
Reply to this message
Author: Don Walker
Date:  
To: exim-users@exim.org
Subject: [exim] saving substr result?
Is there any way to set a variable to preserve the result of substr in a
router acl? My need is to extract two substrings from $local_part and
use them in a condition and mysql query. The code below works, but it
would be cleaner if the two substr uses could be coded once and the
results saved for use in the rest of the code. I have scoured all the
docs I can find and tried to set acl_mX.


maillist:
  driver = redirect
  condition = ${lookup{${substr{0}{5}{$local_part}}} \
     lsearch{/etc/exim/maillists}{yes}{no}}
  data = ${lookup mysql{select email from \
     ${lookup{${substr{0}{5}{$local_part}}}lsearch{/etc/exim/maillists}} \
     where class1 = 
${substr{5}{${eval10:${strlen:$local_part}-5}}{$local_part}} \
     or class2 = 
${substr{5}{${eval10:${strlen:$local_part}-5}}{$local_part}} \
     or class3 = 
${substr{5}{${eval10:${strlen:$local_part}-5}}{$local_part}}}}