I’ve got a stock Debian Etch system, using Exim4. The domains are mostly local but there are some that are remote. To handle the delivery of remote mail I use the Debian configuration file:
/etc/exim4/hubbed_hosts
This file lists the domain names, and remote MX machines to deliver to. For example:
example.org: mx.example.com example.com: mx2.example.com
Looking at the exim4 configuration file I see that this used as follows:
hubbed_hosts: debug_print = 'R: hubbed_hosts for $domain' driver = manualroute domains = '${if exists{CONFDIR/hubbed_hosts}\ {partial-lsearch;CONFDIR/hubbed_hosts}\ fail}' route_data = ${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}} transport = remote_smtp
The issue I have is that some of the hosts I’m using need to have their mail delivered to a non-standard port. Unfortunately the Debian hubbed_hosts file doesn’t work if I try to change it to include a port:
example.org: mx1.example.org:2525 example.com: 1.2.3.4.2525
Is it possible to dynamically allow the port to be specified?
I was hoping for something a little more dynamic – and this solution works:
Then a simple file may have a list of ports on a per-domain basis: