Re: [exim] condtion problem with nested and conditions

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Jakob Hirsch
Data:  
Para: 'Exim-users'
Asunto: Re: [exim] condtion problem with nested and conditions
Martin Hierling wrote:

>   condition = ${if \
>                   and \
>                     { \
>                       { eq {$local_part}{test} } \
>                       { !eq {$interface_port}{2525} } \
>                       { \
>                         and \
>                           { \
>                             { eq {$sender_host_name}{myhost.foobar.de} }\
>                             { match {$header_content-type:}{^text/plain.*} }\
>                           }{no}{yes} \
>                       } \
>                     }{yes}{no} \
>                }


1. there is no need to nest multiple "and" conditions
2. you can put "{no}{yes}" after "and" conditions only if you put an
"if" before
3. you cannot use "{no}{yes}" in an expansion condition, "and" requires
to get a result of a condition (like "eq" etc.)
4. you should always put \N around regular expressions


condition = ${if \
                and \
                  { \
                    { eq {$local_part}{test} } \
                    { !eq {$interface_port}{2525} } \
                    { eq {$sender_host_name}{myhost.foobar.de} } \
                    { match {$header_content-type:}{\N^text/plain.*\N} \
                  }{yes}{no} \
               }


should work.

> So another question is can i have an "and" in another "and" condition?


yes, but it's useless.