[Exim] Multi level if-and statements

Top Page
Delete this message
Reply to this message
Author: support
Date:  
To: exim-users
CC: 
Subject: [Exim] Multi level if-and statements

Im attempting to make a 2 condition if statement into a 3 condition if statemnt...

I started with:
condition = ${if and {{!def:header_X-GForce-Host-Number:}{!eq {$localhost_number}
{2}}} {yes}{no}}

Which works, but I need to add another condition to verify that the user is a local
user.  I ended up with:
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}}

Which doesnt work, an exim -bt to a local account comes out with:
LOG: MAIN PANIC
  failed to expand 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}}" for mail01 router: condition name
expected, but found "${if and {{!def:"

Any suggestions would be appreciated :)

Thanks,

Matt