Re: [Exim] Weird problem getting header match in router

Top Page
Delete this message
Reply to this message
Author: Avleen Vig
Date:  
To: David Saez
CC: Avleen Vig, exim-users
Subject: Re: [Exim] Weird problem getting header match in router
On Wed, Dec 17, 2003 at 07:12:45PM +0100, David Saez wrote:
> > This works and the conditions succeeds:
> > condition = ${if match {$h_x-mailer:}{mPOP Web-Mail 2.19} {yes}{no} }
> >
> > This doesn't:
> >   condition = ${if eq {$h_X-Mailer:}{${lookup mysql{select blocklists.blockval from blocklists,users,domains \
> >               where users.localpart = '${quote_mysql:$local_part}' \
> >               and domains.domain = '${quote_mysql:$domain}' \
> >               and domains.domain_id=blocklists.domain_id \
> >               and users.user_id=blocklists.user_id}{$value}fail} } {yes}{no}}

>
> condition must be true or false, 0 or 1, better try to to something like
> SELECT COUNT(*) ...


That fixed it, and also bypassed another roadblock in my setting up
blocklists. Thanks David.

The final statement I ended up using was:
condition = ${if eq {${lookup mysql{select count(*) from blocklists,users,domains \
              where blocklists.blockhdr = 'x-mailer' \
              and blocklists.blockval = '${quote_mysql:$h_x-mailer:}' \
              and users.localpart = '${quote_mysql:$local_part}' \
              and domains.domain = '${quote_mysql:$domain}' \
              and domains.domain_id=blocklists.domain_id \
              and users.user_id=blocklists.user_id}}}{1} {yes}{no}}