Hi, Rustam -
Can I check your setup? Is it that:
- You have a number of files, one per domain — /etc/exim/d1.example.com
/etc/exim/d2.example.com /etc/exim/d3.example.com and so on
- You want to look up the $sender_address to find the value for
*client_send* to use
Is there a correlation between the domain of $sender_address and the file
its details will be found in?
For example, if the $sender_address value is "me@???" then its
value will always be found in the "/etc/exim/d2.example.com" file?
If so then instead of searching through a list of all the files you could
just extract the domain of $sender_address (it's already in
$sender_address_domain), convert it to lower case, and use that to build
the filename you need to look in using lsearch. For example (untested),
client_send = ${lookup {$sender_address} lsearch \
{/etc/exim/${lc:$sender_address_domain}}}
If you do this remember to check and see it works OK for the edge cases —
eg, what happens if there's no file for a value of $sender_address_domain
(from memory I think it'll return an empty value), or if
$sender_address_domain is empty (because it's a Non-Delivery Report from
the address "<>").
I use a technique like this to implement aliases for domains we virtual
host, and also to choose DKIM signing keys for domains. To help guard
against empty domain name problems I give each filename a suffix, so it's
always non-empty. For example in the above the filename might instead be
chosen with
{/etc/exim/${lc:${sender_address_domain}-authdatastring}}
Cheers,
Mike B-)
On 18 April 2017 at 19:36, Rustam via Exim-users <exim-users@???>
wrote:
> I often need to have exim do a lookup in multiple files at the same time.
> For example, to send a plain auth based on per-domain data:
>
> PLAIN:
> driver = plaintext
> client_send = ${lookup{$sender_address}lsearch{/etc/exim/domain1}}
>
>
> The way I solve it for now is to wrap a subsequent lookup into the negative
> case of the preceding lookup like this:
>
> client_send = ${lookup{$sender_address}lsearch{/etc/exim/domain1}{$
> value}\
> {${lookup{$sender_address}lsearch{/etc/exim/domain2}}}}
>
>
> This solution works, but it is hard to maintain (when the number of files
> is large, it becomes very hard to keep track of the ever growing amount of
> closing braces).
>
> So my proposal is to allow a* list of files* as an argument to lsearch. Of
> if there is an easier solution, I'm open to suggestions.
>
> Regards,
> Rustam
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/
>
--
Systems Administrator & Change Manager
IT Services, University of York, Heslington, York YO10 5DD, UK
Tel: +44-(0)1904-323811
Web:
www.york.ac.uk/it-services
Disclaimer:
www.york.ac.uk/docs/disclaimer/email.htm