Re: [Exim] Syntax for a MySQL select true/false statement

Top Page
Delete this message
Reply to this message
Author: William Thompson
Date:  
To: Eli
CC: exim-users
Subject: Re: [Exim] Syntax for a MySQL select true/false statement
> I want to do a MySQL select to test something, but I don't really have any
> useful data to return. It's a test to see if a user account has forwarding
> enabled (or is an alias), or is a real account to receive actual delivery of
> email. Right now I have:
>
> virtual_user:
>         driver                  = accept
>         domains                 = +virtual_domains
>         transport               = virtual_delivery

>
> virtual_forward:
>         driver                  = redirect
>         no_expn
>         no_verify
>         check_ancestor
>         domains                 = +virtual_domains
>         data                    = ${lookup mysql{SELECT fwd FROM users WHERE
> host = '${quote_mysql:$domain}' AND user = '${quote_mysql:$local_part}' AND
> fwd IS NOT NULL}}

>
>
> But when I send an email to an address that is supposed to forward email
> (not receive delivery), it attempts to receive delivery anyways because it
> just matched the virtual_user router settings first.
>
> I want to add something like:
>
>     condition            = ${lookup mysql{SELECT fwd FROM
> users WHERE host = '${quote_mysql:$domain}' AND user =
> '${quote_mysql:$local_part}'}}


How about: ${lookup mysql{SELECT fwd FROM users WHERE host =
'${quote_mysql:$domain}' AND user = '${quote_mysql:$local_part}'} {yes} {no}}
?