Re: [exim] Condition

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: Konstantin
CC: exim-users
Subject: Re: [exim] Condition
On Thu, Aug 7, 2014 at 9:38 AM, Konstantin <myownletters@???> wrote:
> Hi,
>
> I need to make recipient check against two files.
>
> condition = ${if or{\
>
> {${lookup{$local_part\@$domain}lsearch{/etc/exim/list1}{false}{true}}} \
>
> {${lookup{$local_part\@$domain}lsearch{/etc/exim/list2}{false}{true}}} } }
>
> But it does not work. The error is:
> Failed: condition name expected, but found "${lookup{$local_" inside
> "or{...}" condition


You have the right idea with what you are are trying to do. The or{}
and and{} syntax is pretty specific. It is:

or{ {condition1{}} {condition2{}} {condition3{}} etc }

In your case, the lookup must occur inside the {} part. So what is
the condition? Well, you use a condition to compare the results of
that lookup to something else. In this case, your logic implies that
you want to return true if the user/email is NOT found in the file,
such as a blacklist. So use eq to compare the lookup to an empty
string For example:

eq{ ${lookup{$local_part\@$domain}lsearch{/etc/exim/list1} {}
      {false} {true} }


So when you put it all together, you wrap each eq function with
another set of curly braces and you end up with:

or{
  {eq{ ${lookup{$local_part\@$domain}lsearch{/etc/exim/list1}} {}
          {false} {true} }
  }
  {eq{ ${lookup{$local_part\@$domain}lsearch{/etc/exim/list2}} {}
          {false} {true} }
  }
}


This is untested, but it should work the way you expect it to. Fully
test it first for form, function, and accuracy.

...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine