Debian 指定通过exim4用于邮件的远程端口

Debian 指定通过exim4用于邮件的远程端口,debian,ports,mx-record,exim4,Debian,Ports,Mx Record,Exim4,我有一个库存Debian蚀刻系统,使用Exim4。这些域大部分是本地的,但也有一些是远程的。为了处理远程邮件的传递,我使用Debian配置文件: /etc/exim4/hubbed_hosts 此文件列出了要交付到的域名和远程MX计算机。例如: example.org: mx.example.com example.com: mx2.example.com 查看exim4配置文件,我发现它的用法如下: hubbed_hosts: debug_print = "R: hub

我有一个库存Debian蚀刻系统,使用Exim4。这些域大部分是本地的,但也有一些是远程的。为了处理远程邮件的传递,我使用Debian配置文件:

  /etc/exim4/hubbed_hosts
此文件列出了要交付到的域名和远程MX计算机。例如:

  example.org:  mx.example.com
  example.com:  mx2.example.com
查看exim4配置文件,我发现它的用法如下:

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
我遇到的问题是,我使用的一些主机需要将其邮件发送到非标准端口。不幸的是,如果我试图将Debian hubbed_hosts文件更改为包含端口,则该文件无法工作:

example.org: mx1.example.org:2525
example.com: 1.2.3.4.2525

是否可以动态允许指定端口?

创建一个新的传输来指定端口

remote_hub_2525:
driver = smtp
port = 2525
然后为需要非标准交付的域创建路由器

non_standard_hub:
driver = manualroute
domains = example.org : example.com
transport = remote_hub_2525
no_more

我希望有一个更具活力的解决方案——这个解决方案很有效:

 port = ${if exists{/etc/exim4/ports.list}\
              {${lookup{$domain}lsearch{/etc/exim4/ports.list}\
              {$value}{25}}}{25}}
然后,一个简单文件可能有一个基于每个域的端口列表:

   example.org: 2525
   example.com: 26

您可能可以使用${extract}操作符来组合端口号和主机名,如原始问题中的示例所示

类似于(未经测试):


默认情况下,这实际上是受支持的,而不需要对exim4配置进行任何更改

在hubbed_hosts中,使用冒号分隔主机,并使用双冒号指定端口号。 例:


要了解更多信息,请查看

谢谢您的帮助-我最终成功地以一种更具活力的方式实现了这一目标。
route_data = ${extract{1}{:}{${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}}}
domain1: server1:server2::port:server3
domain2: server1::port
domain3: server1:server2