[prev in list] [next in list] [prev in thread] [next in thread] 

List:       exim-users
Subject:    Re: [exim] Trouble with condition statement
From:       Tony Finch <dot () dotat ! at>
Date:       2004-11-30 10:22:53
Message-ID: Pine.LNX.4.60.0411301018210.23492 () hermes-1 ! csi ! cam ! ac ! uk
[Download RAW message or body]

On Tue, 30 Nov 2004, Peter Bowyer wrote:
> On Tue, 30 Nov 2004 14:07:26 +1100, Andrew Nelson
> <andrew__nelson@hotmail.com> wrote:
> > I have this condition statement in a spam filter router which works well:
> > condition = "${if and {{!def:h_X-Spam-Flag:} \
> > {!eq{$received_protocol}{spam-scanned}}} {1}{0}}" but I also want to add a clause \
> > only to continue if the user's email address exists in a text file..  I have this \
> > but can't get it logically 'and'ed with the above (or maybe's its invalid?):
> > ${lookup{$local_part@$domain}lsearch{/etc/mail/filtered_users}}
> 
> $lookup doesn't directly return true/false, it takes 2 extra arguments
> for success and failure, so
> 
> ${lookup{$local_part@$domain}lsearch{/etc/mail/filtered_users} {1} {0}}
> 
> should work as a sub-clause of your 'and' expression.

No! ${lookup isn't an expansion condition.

To rewrite the original condition more readably...

  condition = ${if and{{ !def:h_X-Spam-Flag: } \
                       { !eq{$received_protocol}{spam-scanned} }} \
                   {yes} {no} }

You can then add the lookup in the true branch of the ${if...

  condition = ${if and{{ !def:h_X-Spam-Flag: } \
                       { !eq{$received_protocol}{spam-scanned} }} \
                   {${lookup {$local_part@$domain} \
                      lsearch {/etc/mail/filtered_users} \
                      {yes} {no} }} \
                   {no} }

Tony.
-- 
f.a.n.finch  <dot@dotat.at>  http://dotat.at/
MALIN HEBRIDES: NORTHEAST 4 OR 5 INCREASING 6. RAIN LATER. GOOD BECOMING
MODERATE.

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at \
http://www.exim.org/ ##


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic