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

Top Page
Delete this message
Reply to this message
Author: Eli
Date:  
To: exim-users
Subject: [Exim] Syntax for a MySQL select true/false statement
Hi,

Does anyone know how I can do this, if it's possible (I think I've seen this
syntax before, but I can't find it again)...

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}'}}


Or whatever, but have it do a true/false depending on if the SELECT returns
NULL or NOT NULL (ie, an email address to forward to).

Can someone show me the syntax for doing that if possible, and if not, maybe
suggest what an alternative is?

If you wish to see the rest of my config file, I can send it to you... I'm
still testing it (going to handle local & virtual users/domains via MySQL).

Thanks in advance!

Eli.

---
[This E-mail scanned for viruses]