[Exim] substituting $local_part after mysql query

Top Page
Delete this message
Reply to this message
Author: Peter Lockhart
Date:  
To: exim-users
Subject: [Exim] substituting $local_part after mysql query
I am setting up a mysql-driven exim to deliver mail to non-system users.

My director:

mysql_system_aliases:
driver = aliasfile
search_type = mysql
query = "select userid from domain_table where aliasid='$local_part'
and domain='$domain'"
transport = local_delivery
file_transport = address_file
pipe_transport = address_pipe

Assuming a sample entry as follows:
+--------+---------+-----------+
| userid | aliasid | domain    |

+--------+---------+-----------+
| peter  | bob     | abc.co.za |

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

the result of the query 'bob@???' should return "peter" (userid),
and hopefully deliver to /var/mail/${local_part} (/var/mail/peter)
through the
local_delivery transport.

The query is substituted correctly and appears to be working according
to exim -d9 -v bob@???:

--snip--
database lookup required for select userid from domain_table where
aliasid='bob' and domain='abc.co.za'
MYSQL query: select userid from domain_table where aliasid='bob' and
domain='abc.co.za'
MYSQL using cached connection for localhost/exim_vmail//
lookup yielded: peter
queued for mysql_local_delivery transport uid=68 gid=6
mysql_system_aliases director succeeded for bob
bob@???
deliver to bob in domain abc.co.za
--snip--

What _is_ happening is that mail is going to /var/mail/bob instead.
although the query succeeds, it is ignored.

How do I have the query result replace $local_part.
file = /var/mail/${query} doesnt work etc ...


Any help would be appreciated

Regards
Peter Lockhart