Do you use let's encrypt?





4934 votes ~ 18 comments

 

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.

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

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

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

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 ]