This site is now 100% read-only, and retired.

XML logo

Bypassing the smarthost in Exim4
Posted by lee on Tue 17 Jun 2008 at 17:47
Tags: ,

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.

  debug_print = "R: notsmart_dnslookup for $local_part@$domain"
  driver = dnslookup
  domains = "${if exists{CONFDIR/notsmart}\
  transport = remote_smtp
  same_domain_copy_routing = yes

Now, if I add "" to "/etc/exim4/notsmart", any mail to (or will be delivered directly rather than via the smarthost, but will go via the smarthost.


Comments on this Entry

Re: Bypassing the smarthost in Exim4
Posted by kenji (77.12.xx.xx) on Sun 28 Nov 2010 at 19:34
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


[ Parent ]

Re: Bypassing the smarthost in Exim4
Posted by lee (90.193.xx.xx) on Sat 4 Dec 2010 at 23:38
[ View Weblogs ]

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

  debug_print = "R: force_smarthost for $local_part@$domain"
  driver = manualroute
  domains = "${if exists{CONFDIR/smart}\
  transport = remote_smtp_smarthost
  route_list = * byname
  host_find_failed = defer
  same_domain_copy_routing = yes

[ Parent ]