[Exim] Re: Multi level if-and statements

Top Page
Delete this message
Reply to this message
Author: Rutger van Oosten
Date:  
To: exim-users
Subject: [Exim] Re: Multi level if-and statements
I think that you cannot use an "if" inside an "and" because "if" is not a
condition but an expansion. The same goes for "lookup". You also don't
need the nested "and" because you can put more than 2 conditions in a
single "and".. So something like this should work (untested):

condition = ${if and {\
    {!def:header_X-GForce-Host-Number:}\
    {!eq {$localhost_number}{3}}\
    {eq{${lookup mysql{\
        SELECT REPLACE(accounts.account, '@', '\\\\@') as account\
        FROM email.accounts, email.aliases, bind.zones\
        WHERE accounts.account_id=aliases.account_id\
        AND zones.zone_id=aliases.zone_id\
        AND zones.zone='${quote_mysql:$domain}'\
        AND aliases.alias='${quote_mysql:$local_part}'\
        AND aliases.account_id > 0\
        AND aliases.remote_addr = ''\
    }{1}{0}}}{1}}\
    }{1}{0}}


Let me know if it works for you!
Rutger

support@??? wrote in
news:E19VHF0-0002cx-00@???:

> condition = ${if and {\
>           {${if and {{!def:header_X-GForce-Host-Number:}{!eq
> {$localhost_number}{3}}} {yes}{no}}}\
>           {${lookup mysql{\
>                        SELECT REPLACE(accounts.account, '@', '\\\\@')
>                        as
> account \
>                        FROM email.accounts, email.aliases, bind.zones
>                        \ WHERE accounts.account_id=aliases.account_id
>                        \
>                                AND zones.zone_id=aliases.zone_id \
>                                AND zones.zone='${quote_mysql:$domain}'
>                               \  AND
> aliases.alias='${quote_mysql:$local_part}' \
>                                AND aliases.account_id > 0 \
>                           AND aliases.remote_addr = '' \
>                  }}\
>           }\
> } {yes}{no}}