[Exim] $address_data and appendfile transport

Top Page
Delete this message
Reply to this message
Author: Matthias Pronk
Date:  
To: exim-users
Subject: [Exim] $address_data and appendfile transport
Hi!

I'm trying to make exim work with MySQL. But I have some problems:

   1. I can't make the appendfile transport to use data that has been
      queried in the router (using $address_data). Can you tell me what
      I'm doing wrong?
   2. The 'mysql_user' router doesn't seem to 'decline' when there are
      no records returned from MySQL to $address_data.
      The only way I could make it work, was adding a 'condition' to the
      router with the same query. How can I make the router 'decline' if
      the query in 'address_data' returns no rows?
   3. I've got a router which maps anything@??? to
      anything@???, i've called it domain aliases.
      The only way i could make it work was using the MySQL concat
      function (which I think isn't very nice), are there options to do
      this 'concatenation' in Exim?


I've included relevant parts of my 'configure':

MYSQL_LOCALPART = ${quote_mysql:$local_part}

MYSQL_QUERY_DOMAINS = SELECT domain FROM domain WHERE domain='${domain}'
MYSQL_QUERY_DOMAINALIASES = SELECT CONCAT('MYSQL_LOCALPART@', alias)
FROM domain WHERE domain='${domain}' AND type='alias'
MYSQL_QUERY_FORWARD = SELECT destination FROM alias WHERE
localpart='MYSQL_LOCALPART' AND domain='${domain}'
MYSQL_QUERY_USER = SELECT maildir, uid, gid FROM user WHERE
localpart='MYSQL_LOCALPART' AND domain='${domain}' AND user_lock != '1'
MYSQL_QUERY_CATCHALL = SELECT catchall FROM domain WHERE domain='${domain}'


domainlist local_domains = ${lookup mysql { MYSQL_QUERY_DOMAINS }}

# Routers:

mysql_domain_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup mysql { MYSQL_QUERY_DOMAINALIASES }{ $value }}

mysql_forward:
driver = redirect
allow_defer
allow_fail
data = ${lookup mysql { MYSQL_QUERY_FORWARD }{ $value }}
domains = +local_domains
qualify_preserve_domain
retry_use_local_part

mysql_user:
driver = accept
# This condition should'nt be needed:
condition = ${lookup mysql { MYSQL_QUERY_USER }{ $value }}
address_data = ${lookup mysql { MYSQL_QUERY_USER }{ $value }}
retry_use_local_part
transport = mysql_delivery

mysql_catch_all:
driver = redirect
domains = +local_domains
data = ${lookup mysql { MYSQL_QUERY_CATCHALL }{ $value }}

# Transports:
remote_smtp:
driver = smtp

mysql_delivery:
driver = appendfile
maildir_format
directory = ${extract{ maildir }{ $address_data }}
delivery_date_add
envelope_to_add = true
return_path_add = true
user = ${extract{ uid }{ $address_data }}
group = ${extract{ gid }{ $address_data }}



Thank you very much in advance!
Greetz,
- Matthias