[Exim] Using a smarthost based on destination MX record

Top Page
Delete this message
Reply to this message
Author: Matthew Hodgson
Date:  
To: exim-users
Subject: [Exim] Using a smarthost based on destination MX record
Hi,

In order to get round certain big ISPs rejecting incoming mail from
domestic IP ranges, I've been using a manualroute router with a domains
precondition to route such mail via my ISP's smarthost.

However, I just realised that it makes much more sense to send such mail
via the smarthost depending on the resolved MX record of the remote server
for that domain rather than the @domain in the destination e-mail address.

I've tried to implement this by removing the manualroute 'smartroute'
router and tweaking the main smtp transport (remote_smtp) to be:

remote_smtp:
driver = smtp
hosts = ${lookup{$host} wildlsearch {/etc/exim/mx_smarthost} {smtp.ntlworld.com}{$host}}
hosts_override

where /etc/exim/mx_smarthost is:

phoenix 28# cat /etc/exim/mx_smarthost
# List of MX records for which we have to smarthost
# because they block domestic IP ranges
# (e.g. aol.com etc.)

*.aol.com
*.netscape.net
*.rr.com
*.rmplc.co.uk
*.eng.cam.ac.uk

I'm worried, however, that I'm clobbering the round-robin redundant
fallover for normal domains which have equal priority MX records by doing
this.

Specifically, I thought that the dnslookup router would give the
smtp_transport a list of equal priority MX records (and if those hosts
have multiple A records, then those too) as the 'host list' for that
message - and thus setting hosts_override and hosts = $host will clobber
everything but the first item in that list.

Superficially things seem to behave much as they do without the
hosts_override and hosts=$host (experimenting by blocking all of
mx?.hotmail.com apart from one of the A record addresses of
mx3.hotmail.com at the firewall) - but i'm concerned lest this might end
up deferring/freezing/bouncing messages rather than attempting to use the
other hosts that dnslookup might have fed the transport?

Any comments would be greatly appreciated;

M.