[Exim] mysql lookups

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Konrad Michels
Dátum:  
Címzett: exim-users
Tárgy: [Exim] mysql lookups
Hi there folks!
Apologies for taking up everyone's time with something that I know I've
seen answered before, but I've trawled the archives now for a couple of
hours and can't find it.

Setup is Exim 4.34 on FC2 (yes I know . . .) and MySQL 4.0.20 (and a
couple of other bits which aren't that important for this question).
I've got Exim up and going, doing alias lookups against a table in a
database, as well as looking up the delivery location details for local
deliveries (virtual users).

So, what I've got is the following in routers:

surfkitchen_com_aliases:
  driver = redirect
  allow_fail
  allow_defer
  data = ${lookup mysql{SELECT address FROM aliases \
       where alias='${quote_mysql:$local_part}'}}


surfkitchen_com:
driver = accept
transport = surfkitchen_com_local_delivery
domains = surfkitchen.com

and then in Transports I've got:

surfkitchen_com_local_delivery:
  driver = appendfile
  directory = ${lookup mysql{SELECT maildir FROM smtp \
                WHERE username='${quote_mysql:$local_part}@$domain'}}
  maildir_format
  create_directory
  user = 512
  group = 512
  allow_symlink
  delivery_date_add
  envelope_to_add
  return_path_add


Now this all works quite OK when the query finds something in the
"username" field which matches $local_part@$domain. Mail gets delivered
exactly to where it is supposed to be delivered. Problem is that for
non-existant users, instead of bombing out at SMTP time and refusing the
message as it would with "check_local_user" in a normal delivery, it
"accepts" the message but in the logs I get:

appendfile: file or directory name "" is not absolute

which makes sense, since the database query is returning a blank.

So my question is how to get it to refuse the mail at SMTP time when the
database lookup returns a blank result? I know its something to do with
{yes}{no}, and I suspect it should be in the transport, and I've tried a
good many variations on my lookup, but can't get it doing what I'm
intending it to do.

Any assistance would be greatly appreciated.

Many thanks in advance, and have a great day!

Konrad