On Mon, 15 Sep 2003, Matthias Pronk wrote:
> 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?
Have you used the -d option to test? It should show you what is being
set in $address_data. However, I think your problem might be to do with
spaces:
> 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 }}
Try using {maildir} and {uid} instead of { maildir } and { uid }.
Maybe it should, but I don't think Exim does, remove leading and trailing
spaces from key names.
> 2. The 'mysql_user' router doesn't seem to 'decline' when there are
> no records returned from MySQL to $address_data.
There's no reason why it should. You have specified:
address_data = ${lookup mysql { MYSQL_QUERY_USER }{ $value }}
If the lookup fails, $address_data is set to the empty string because
you have not specified what to do on failure, and that is the default.
If you read the spec for address_data, you will find (in doc/spec.txt):
address_data Type: string* Default: unset
The string is expanded just before the router is run, that is, after all
the precondition tests have succeeded. If the expansion is forced to fail,
the router declines. Other expansion failures cause delivery of the
address to be deferred.
Note the second sentence. You need to force expansion failure if you
want the router to decline. Specifically, you need
address_data = ${lookup mysql { MYSQL_QUERY_USER }{ $value }fail}
(And incidentally, do you actually want the leading and trailing space
after $value? They will be taken as part of the data.)
> 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'm not an SQL person, so not sure exactly what you are doing. However,
concatentation can be achieved in expanded strings. A lookup is just
part of an expanded string. If you just want to change a domain by
lookup, you can do something like
data = $local_part@${lookup .... to select a new domain}
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book: http://www.uit.co.uk/exim-book