[Exim] Multiple domain aliasses via MySQL

Top Page
Delete this message
Reply to this message
Author: Cipriano Groenendal
Date:  
To: Exim-users
Subject: [Exim] Multiple domain aliasses via MySQL
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Hello List.

For the past few days I've been trying to get MySQL based aliases to work. My idea was that, since I'll be hosting multiple domains for customers, I'd create a MySQL database and do lookups via that. I created a database that looks roughly like this:

+-------+------------+--------+------+
| alias | domain     | user   | uid  |

+-------+------------+--------+------+
| *     | cipri.com  | cipri  | 2000 |
| *     | cerala.com | cerala | 2001 |

+-------+------------+--------+------+

And I created this Director:

mysql_aliases:
driver = aliasfile
file_transport = address_file
pipe_transport = address_pipe
transport = local_delivery
no_more
search_type = mysql
query = "SELECT tblAliases.user FROM tblAliases WHERE \
( \
(tblAliases.alias='$local_part' && tblAliases.domain='$domain' ) \
OR \
(tblAliases.alias='*' && tblAliases.domain='$domain' ) \
) \
LIMIT 1"


When I run exim -d9 -bt cipri@???, and run the SQL statement manually I get back a single value of `cipri`, which is where it should be delivered to. However, when I try a random address this happens:


# exim -bt foobar@???
foobar@???
deliver to foobar in domain cipri.com
director = mysql_aliases, transport = local_delivery


I guess I'm removing the wrong data from the database, but I can't find anywhere in the FAQ what I should query from the database exactly. I had this working like this some time ago, but ever since we lost the config, I've had to no luck at getting things to work again.

Any help would be appreciated,
Cipri
--