Excellent, this did the trick! I'll also take a look at the sender callouts stuff to determine whether or not we should.
> On Mon, 2009-10-05 at 14:08 -0700, Ernie Dunbar wrote: >> http://struction.de/projects/HOWTO_VirtualMail_Exim-MySQL-Spamassassin-ClamAV-Dovecot/index > > Looks good except that it uses sender callouts, but let's not start that > **** fight argument again. > >> The basic gist is that user accounts are stored in a MySQL database for >> Dovecot (that part works). I need Exim to check this database for valid >> users, and when the domain part is "lightspeed.ca", it looks for the >> user >> field in the database, with a blank domain name. Otherwise, Exim needs >> to >> do another MySQL lookup to check to make sure both the local part and >> the >> domain exist in the database. The pseudo code looks like this: >> >> if $domain = "lightspeed.ca" and lookup mysql { >> SELECT CONCAT(username,'@',domain) AS email >> FROM user >> WHERE username='${quote_mysql:$local_part}' >> AND domain='' >> } >> elif match $domain lookup mysql { >> SELECT CONCAT(username,'@',domain) AS email >> FROM user >> WHERE username='${quote_mysql:$local_part}' >> AND domain='${quote_mysql:$domain}' >> } >> } >> >> The following Exim router works, but not with the users in the database >> that have no domain part: >> >> mysql_user: >> driver = accept >> # restriction to local domains only may be a double check, as the >> condition takes care of it already ;-) >> domains = +local_domains >> condition = ${lookup mysql{ \ >> SELECT CONCAT(username,'@',domain) AS email \ >> FROM user \ >> WHERE username='${quote_mysql:$local_part}' \ >> AND domain='${quote_mysql:$domain}' \ >> AND SMTP_allowed='YES' \ >> }{true}{false}} >> local_part_suffix = +* >> local_part_suffix_optional >> transport = local_mysql_delivery >> no_more > > As it stands, a lightspeed.ca account gets the exact same lookup as an > example.com user. > > So .... make 2 routers. Put this one before the other so that it pulls > the lightspeed.ca ones out before the other +local_domains one. > > You might want to get rid of the CONCAT bit if you're not using it, and > instead just select a column. > > mysql_user_lightspeed: > driver = accept > domains = lightspeed.ca > condition = ${lookup mysql{ \ > SELECT CONCAT(username,'@',domain) AS email \ > FROM user \ > WHERE username='${quote_mysql:$local_part}' \ > AND domain='' \ > AND SMTP_allowed='YES' \ > }{true}{false}} > local_part_suffix = +* > local_part_suffix_optional > transport = local_mysql_delivery > no_more > > -- > The Exim manual - http://docs.exim.org > > > -- > ## List details at http://lists.exim.org/mailman/listinfo/exim-users > ## Exim details at http://www.exim.org/ > ## Please use the Wiki with this list - http://wiki.exim.org/ > -- ## List details at http://lists.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
