[Exim] bounce when SQL query fails?

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Mikael Gunnarsson
Datum:  
To: exim-users
Betreff: [Exim] bounce when SQL query fails?
Hi!

I'm working on a virtual-domain setup where all the domains and addresses are stored in a local mySQL database.. I have configured the following:

domainlist local_domains = "server.dom.ain:\
                            mysql;select domain from mail where domain='$domain'"



I've written a router like this.. I'm guessing there's a better way than this to do wildcards, so if you know of one please enlighten me..

virtual_aliases:
driver = redirect
domains = mysql;select domain from mail where domain='$domain'
data = ${lookup mysql{select target from mail where (localpart='$local_part' or localpart='*') and domain='$domain' order by localpart desc limit 1}{$value}fail}
file_transport = virtual_delivery


And finally a transport like this:

virtual_delivery:
driver = appendfile
file = ${lookup mysql{select path from users where username = '$local_part'}{$value}fail}
delivery_date_add
envelope_to_add
return_path_add
group = exim
mode = 0660


This works pretty well, except that when the router lookup fails, it doesn't bounce the mail with a 'unknown local part' like I want it to, but instead defers the mail until it times out, and then bounces "Expansion of "${lookup mysql{select path from users where username = '$local_part'}{$value}fail}" (file or directory name for virtual_delivery transport) failed: "lookup" failed and "fail" requested" .. Of course, this is undesirable..

So, anyone know how I can define what action should be taken when the router fails and what error message to send back in case of a bounce?

Thanks
Mikael