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

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Ollie Cook
日付:  
To: Jeffrey Wheat
CC: exim-users
題目: 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