RE: [Exim] Help with condition statement needed (second try)

Top Page
Delete this message
Reply to this message
Author: Jeffrey Wheat
Date:  
To: Ollie Cook
CC: exim-users
Subject: RE: [Exim] Help with condition statement needed (second try)
Ollie,

    Thank you as well! It is now working.


Regards,
Jeff

> -----Original Message-----
> From: Ollie Cook [mailto:ollie@uk.clara.net]
> Sent: Wednesday, July 02, 2003 3:34 PM
> To: Jeffrey Wheat
> Cc: exim-users@???
> Subject: Re: [Exim] Help with condition statement needed (second try)
>
>
> On Wed, Jul 02, 2003 at 09:54:21AM -0400, Jeffrey Wheat wrote:
> >   condition = "${if and {{eq {${lookup mysql{select discard
> from accounts
> >   where username = '$local_part' and domain = '${domain}'
> and discard =
> >   'y'}{$value}}}{y}} {  {eq {$header_X-Spam-Flag:}{YES} } } {1}{0}}"
>                        ^

>
> Hi Jeffrey,
>
> You have a bracket mismatch (one more '{' than '}') in this
> condition which is why the expansion is failing.
>
> The problem was an extra '{' before the second 'eq'. I've
> highlighted it above.
>
> I've formatted the condition 'prettily' below to show where
> the other various brackets match. I've also put the query
> into a macro to make it easier to read, and quoted the
> variables in the query.
>
> Since you don't necessarily care about the value of the
> result of the query, but rather whether a row exists or not
> in the database, you might want to consider using
> "mysql;QUERY" rather than a $lookup{ which would simplify the
> condition by reducing some brackets.
>
> QUERY = SELECT discard FROM accounts WHERE username =
> '${quote_mysql:$local_part}' and domain =
> '${quote_mysql:$domain}' AND discard = 'y'
>
> condition = "${if and {                                      \
>                         {eq                                  \
>                           {${lookup mysql{QUERY}{$value}}}   \
>                           {y}                                \
>                         }                                    \
>                         {eq                                  \
>                           {$header_X-Spam-Flag:}             \
>                           {YES}                              \
>                         }                                    \
>                       }                                      \
>                       {1}                                    \
>                       {0}                                    \
>               }"

>
> Cheers,
>
> Ollie
> --
> Oliver Cook    Systems Administrator, Claranet UK
> ollie@???                  020 7903 3065

>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.492 / Virus Database: 291 - Release Date: 6/24/2003
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.492 / Virus Database: 291 - Release Date: 6/24/2003