Weblog entry #36 for lee
The standard Exim configuration for mail delivery in Debian is usually one of two methods: do DNS lookups and deliver direct to IP, or send via a smarthost.
In my specific case I want to keep the server configured to deliver via a smarthost, but for specific domains I want it to do direct delivery (bypassing an issue caused by delivery congestion on the smarthost).
The default Debian Exim config already has the concept of setting up manual routes for specific domains ("hubbed_hosts"), but what I want is to default to dnslookup based routes for specific domains.
The solution is to drop a new router into the config - conf.d/router/190_local_notsmart - that's a cross between hubbed_hosts and dnslookup.
notsmart_dnslookup:
debug_print = "R: notsmart_dnslookup for $local_part@$domain"
driver = dnslookup
domains = "${if exists{CONFDIR/notsmart}\
{partial-lsearch;CONFDIR/notsmart}\
fail}"
transport = remote_smtp
same_domain_copy_routing = yes
no_more
Now, if I add "example.com" to "/etc/exim4/notsmart", any mail to test@example.com (or test@foo.example.com) will be delivered directly rather than via the smarthost, but test@example.net will go via the smarthost.
Comments on this Entry
I've not tested the snippet below. I recommend you read the manualroute rotuter documentation to craft something appropriate.
Assuming the standard config type is set to "internet" rather than "smartest". And assuming you only use one smarthost. Put something like the following in conf.d/router/190_local_forcesmart
force_smarthost:
debug_print = "R: force_smarthost for $local_part@$domain"
driver = manualroute
domains = "${if exists{CONFDIR/smart}\
{partial-lsearch;CONFDIR/smart}\
fail}"
transport = remote_smtp_smarthost
route_list = * your.smarthost.name byname
host_find_failed = defer
same_domain_copy_routing = yes
no_more
[ Parent | Reply to this comment ]
[ Send Message ]
i need exact this way, but only in reverse configuration,
route domains in a list to a smarthost with smtp authentification. do you had an configuration sample?
thanks a lot
Daniel
[ Parent | Reply to this comment ]