Re: [exim] Trouble with condition statement

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Tony Finch
Data:  
Para: Exim Users Mailing List
Asunto: Re: [exim] Trouble with condition statement
On Tue, 30 Nov 2004, Peter Bowyer wrote:
> On Tue, 30 Nov 2004 14:07:26 +1100, Andrew Nelson
> <andrew__nelson@???> 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@???> http://dotat.at/
MALIN HEBRIDES: NORTHEAST 4 OR 5 INCREASING 6. RAIN LATER. GOOD BECOMING
MODERATE.