Re: [exim] SMTP Transport: hosts rewriting

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: christian meutes
CC: exim-users
Subject: Re: [exim] SMTP Transport: hosts rewriting
On Fri, 7 Jul 2006, christian meutes wrote:

> > However, I've now looked at the code. It turns out that $host_address is
> > set to the IP address of the first host that the router passes to the
> > transport right at the start. So as long as your MX records only ever
> > return ONE IP address, it will work.
>
> How does this work with a normal smtp transport? Doesnt it try the second
> MX record with the lower prio when the first one isnt available?


Of course. What happens is this:

Get a list of hosts from MX records
Set $host and $host_address to the first host's name and address [1]
Run the smtp transport
The transport expands the "hosts" option to get a list of hosts [2]
For each host in the list
{
Set $host_address to the address and $host to the name
Try to deliver to that host
}

[1] This in fact happens as part of a general setup before running any
transport, when things like $domain and $local_part get set, if
relevant. The original motivation for setting $host and $host_address
was for cases where the transport is NOT the smtp transport but, for
example, an appendfile transport that is saving messages for particular
hosts in files (so it needs to know which host).

[2] For your configuration, where hosts and hosts_override are set.

I had forgotten about [1], which is why I originally thought that your
configuration couldn't possibly work.


-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book