Re: [exim] SMTP Transport: hosts rewriting

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Philip Hazel
Data:  
Para: christian meutes
CC: exim-users, Peter Bowyer
Assunto: Re: [exim] SMTP Transport: hosts rewriting
On Thu, 6 Jul 2006, christian meutes wrote:

> > remote_smtp:
> > driver = smtp
> > hosts_override = true
> > hosts = ${if eq{$host}{10.10.10.10}{$host}{172.20.20.20}}
> >
> > Doesn't work because $host is not set at this point. But if you can
> > somehow identify the domains, a special transport with hosts_override
> > might do the trick. One way could be to do your own DNS lookups using
> > dnsdb, as suggested already.
> >
> I got it working!
> I permute the return values and used $host_address instead of $host like this:
>
> remote_smtp:
> driver = smtp
> hosts_override = true
> hosts = ${if eq {$host_address}{10.10.10.10}{172.20.20.20{$host_address}}
>
> Why does this work, can this be true or did i make a mistake when testing it?


At first, I did not believe that this could possibly work. The value of
$host_address is not set in the transport until the transport selects
one of its list of hosts to try.

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.


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