Re: [exim] Cannot negate router lookup condition

Top Page
Delete this message
Reply to this message
Author: Sebastian Arcus
Date:  
To: exim-users
Subject: Re: [exim] Cannot negate router lookup condition


On 12/08/20 22:04, Jeremy Harris via Exim-users wrote:
> On 12/08/2020 21:45, Sebastian Arcus via Exim-users wrote:
>> I am running Exim 4.89. I have the following router in exim.conf:
>>
>> send_direct:
>>     driver = dnslookup
>>     condition = ! ${lookup{$local_part@$domain}\
>>           lsearch{/etc/exim/exim.passwd}{$value}{}}
>>     transport = remote_smtp
>
> That exclamation-mark is not interpreted; it just becomes part
> of the string, with the expansion result, being tested by the
> "condition" option.
>
> The latter is documented as:
> "if the result is [...] one of the strings “0” or “no” or “false”
> (checked without regard to the case of the letters), the router is skipped.
>
> So: forget the "!", and just have your lookup returning {0} or {1}.
> Put them in *that* order in the ${lookup...} so that your condition
> has the truth sense you wanted.
>
>
> (You were assuming the rules for an ACL condition apply to a router
> condition. Sorry. but historical reasons...)


Arrrgh - thank you so much for this! I've been banging my head for hours
- reading and re-reading the documentation. I never realised that the
exclamation mark doesn't work in router conditions. Reversing the order
of {1}{0} and removing the exclamation worked as expected. Again, much
appreciated the quick and helpful reply!