Re: [Exim] Exim & MySQL

Top Page
Delete this message
Reply to this message
Author: William Thompson
Date:  
To: Matthias Pronk
CC: exim-users
Subject: Re: [Exim] Exim & MySQL
> I'm trying to configure Exim 4.14 with MySQL, but have some problems
> with the lookups. I would like to do virtual domains (mail arrives for
> multiple domains, and john@??? != john@???).
> But i find that sometimes mail (which should be forwarded to an other
> e-mail address) is returned with the following error:
>
>     Delay reason: Failed to find group "" from expanded string
> "${lookup mysql{
> SELECT gid FROM users WHERE address='${local_part}@${domain}' }}" for
> the
> mysql_delivery transport

>
> The router in my Exim configuration file which should handle this is:
>
> ---
> MYSQL_QUERY_ALIASES = SELECT dest FROM aliases WHERE
> user='${local_part}' AND domain='${domain}'
>
> mysql_aliases:
> driver = redirect
> allow_fail
> allow_defer
> data = ${lookup mysql { MYSQL_QUERY_ALIASES }}


This looks like your problem..  try this:
    data = ${lookup mysql { MYSQL_QUERY_ALIASES }{$value}}


You'll need to do the same thing for the rest of the lookups as well.

Basically, you're saying data = "" because the lookup returns information in
$value but you're not using it. I've been burned with this before.

> ---
>
> But for some reason it is handled by this router (which comes later in
> the config file):
>
> ---
> mysql_user:
> driver = accept
> retry_use_local_part transport=mysql_delivery
> ---
>
> and this transport:
>
> ---
> MYSQL_QUERY_DIRECTORY = SELECT CONCAT(home, maildir) FROM users WHERE
> address='${local_part}@${domain}'
> MYSQL_QUERY_UID = SELECT uid FROM users WHERE
> address='${local_part}@${domain}'
> MYSQL_QUERY_GID = SELECT gid FROM users WHERE
> address='${local_part}@${domain}'
>
> mysql_delivery:
> driver = appendfile
> maildir_format
> directory = ${lookup mysql{ MYSQL_QUERY_DIRECTORY }}
> delivery_date_add
> user = ${lookup mysql{ MYSQL_QUERY_UID }}
> group = ${lookup mysql{ MYSQL_QUERY_GID }}
> ---
>
> Can anybody of you help me out? I couldn't find a nice tutorial on Exim
> 4 (all of them are written for Exim 3).
>
> If you want to, I can send you my configure, a dump of my database
> tables, etc.
>
> Many thanks for your attention!