【问题标题】:Specify remote port to use for mail via exim4通过 exim4 指定用于邮件的远程端口
【发布时间】:2010-09-14 08:35:06
【问题描述】:

我有一个库存的 Debian Etch 系统,使用 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

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

【问题讨论】:

    标签: debian ports mx-record exim4


    【解决方案1】:

    这实际上是默认支持的,无需更改您的 exim4 配置。

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

    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

    【讨论】:

      【解决方案2】:

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

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

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

         example.org: 2525
         example.com: 26
      

      【讨论】:

        【解决方案3】:

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

        类似的东西(未经测试):

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

        【讨论】:

          【解决方案4】:

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

          remote_hub_2525:
          driver = smtp
          port = 2525
          

          然后为需要非标准交付的域创建一个路由器

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

          【讨论】:

          • 感谢您的帮助 - 我最终设法让它以我想要的更加动态的方式工作。
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-03-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-12-22
          • 2011-11-09
          相关资源
          最近更新 更多