Re: [Exim] Condition help

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Chris Bayliss
CC: exim-users
Subject: Re: [Exim] Condition help
On Tue, 27 Nov 2001, Chris Bayliss wrote:

> I'm trying to put two conditions together with an and,
> without success. Both seem to work independently.
> I think I've made a simple mistake but seem to be
> going round in circles.
>
> Any suggestions about what my mistake is would be
> appreciated.
>
> condition = "${if and {{ eq {$header_X-bham-spamfiltered:}{yes}{0}{1}} \
> ${lookup {$local_part}lsearch{/usr/exim/tables/master/optin}{true}{false}}}}"


I split it down to analyse it like this:

${if and
{
{ eq {$header_X-bham-spamfiltered:}{yes}{0}{1}}

${lookup {$local_part}lsearch{/usr/exim/tables/master/optin}{true}{false}}}}

1st line: the start of the if and
2nd line: the { that encloses a sequence of conditions to be anded
3rd line: the first of the conditions, enclosed in {}
4th line: oops. there's your problem. there is no starting { for the
          next condition


... and what's more, the next thing is not an expansion condition, it's a
lookup.

Hmm. Maybe "true" and "false" should be valid expansion conditions, but
at the moment they are not.

That is, you can't say     ${if true {yes}{no}}.



The easiest way to rewrite this is to use the conditional property of
the lookup:

condition = ${lookup {$local_part}lsearch{/usr/exim/tables/master/optin}\
             {\
             ${if eq {$header_X-bham-spamfiltered:}{yes}{yes}{no}}\
             }\
             {no}\
             }






-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.