我有一个使用Exim4的股票Debian Etch系统。这些域主要是本地的,但也有一些是远程的。要处理远程邮件的传递,我使用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

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

有帮助吗?

解决方案 2

我希望有一些更有活力的东西 - 这个解决方案有效:

 port = ${if exists{/etc/exim4/ports.list}\
              {${lookup{$domain}lsearch{/etc/exim4/ports.list}\
              {$value}{25}}}{25}}

然后,一个简单的文件可能有一个基于每个域的端口列表:

   example.org: 2525
   example.com: 26

其他提示

默认情况下,实际上支持此功能,而不对exim4配置进行任何更改。

在hubbed_hosts中,您使用冒号分隔主机,并指定带有双冒号的端口号。     EX:

domain1: server1:server2::port:server3
domain2: server1::port
domain3: server1:server2

有关详细信息,请查看 http:/ /www.exim.org/exim-html-current/doc/html/spec_html/ch20.html#SECID122

您可以使用$ {extract}运算符来组合端口号和主机名,就像原始问题中的示例一样。

像(未经测试)的东西:

route_data = ${extract{1}{:}{${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}}}

制作一个指定端口的新传输

remote_hub_2525:
driver = smtp
port = 2525

然后为需要非标准传递的域创建路由器

non_standard_hub:
driver = manualroute
domains = example.org : example.com
transport = remote_hub_2525
no_more
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top