Re: [exim] router condition, problem with "and"

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Lena
Data:  
Para: exim-users
Assunto: Re: [exim] router condition, problem with "and"
> From: Jonas Forsberg

> The condition consists of two parts:
>
> 1st a check in the Subject field after a string, that I have
> got to work.
>
> condition = ${lookup mysql{ SELECT email FROM users
> WHERE email='${quote_mysql:$local_part}@${quote_mysql:$domain}'}
> {true}{false}}
>
> 2nd a check in a MySQL table, which I have been working.
>
> condition = ${if match{$h_subject:}{N^KalleKalas$N}{yes}{no}}
>
> but to combine those two into a
> "and rule" makes my head spin.


> From: Marcin Miros?aw


> condition = ${if and{
> {lookup mysql{SELECT 1 FROM users WHERE
> email='${quote_mysql:$local_part}@${quote_mysql:$domain}'}}
> {if match {$h_subject:}{N^KalleKalas$N}{yes}{no}}}
> }


Wrong because:

> From: Odhiambo Washington


>   ${if and {
>            {cond1}
>            {cond1}
>            {cond3}
>            ...
>            }
>            {truestring}{falsestring}}


"lookup" is not a condition. You can use "eq" condition:

 condition = ${if and{\
   {eq{${lookup mysql{SELECT email FROM users \
             WHERE email='${quote_mysql:$local_part}@${quote_mysql:$domain}'}\
             {1}{0}}}\
      {1}}\
   {match{$h_subject:}{\N^KalleKalas$\N}}\
              }}


The "bool" condition allows to write this a little clearer, but
it's implemented only in Exim 4.70 and later versions.