Weblog entry #36 for lee

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.

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Mail Filtering

Quick Site Search