On 2008-10-02 at 09:40 +0200, Rejo Zenger wrote:
> I am trying to create a nested condition for a router and I seem to be 
> unable to get it working. I have now:
> 
>       ${if and { \
>               { or { \
>                       {def:h_List-Id:} \
>                       {eq {$sender_address}{}} \
>                       {match{$h_X-Spam-Flag:}{(?i)YES}} 

You're missing a backslash at the end of that line.

>                       } {false}{true} } \

This is the problem, I suspect.  The {false}{true} here is what you'd
use in ${if CONDITION {TRUE-CASE}{FALSE-CASE}} after CONDITION.  The
or{{C1}{C2}{C3}} together forms a condition.  The and{{C4}{C5}} forms a
condition.  C1...C5 are conditions.  So the and{} takes conditions, not
strings.

What you're writing is:
 ${if and{
          {or { {...}{...}{...} } EXTRA-BITS}
          ....}}

and the EXTRA-BITS is leading to a parse error, with a less than ideal
error message.

Instead, you could use and{{!or{.....}}{second-and-case}} using ! to
negate the condition.

>               { or { \
>                       {match{$h_To:}{$local_part}} \
>                       {match{$h_Cc:}{$local_part}} \
>                       } {true}{false} } \
>               } {true}{false} \
>       }

> Background: I am trying to set the condition that will match messages 
> that do not have a List-Id header, that do not have a X-Spam-Flag header 
> set to "yes", that do not have a empty sender address (e.g. message is a 
> bounce) and which has the local user's username in either the To or Cc 
> field. 

So expressing that directly and assuming that the username is, by this
point, the $local_part being routed:

 ${if and{\
          {!def:h_List-Id:}\
          {!eqi{$h_X-Spam-Flag:}{yes}}\
          {!eq {$sender_address}{}}\
          {forany{${addresses:$h_To:}:${addresses:$h_Cc:}}\
                 {eqi{$local_part}{${local_part:$item}}}}\
          }}

Regards,
-Phil

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to