代码之家  ›  专栏  ›  技术社区  ›  Steve Kemp

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

  •  3
  • Steve Kemp  · 技术社区  · 18 年前

    我有一个库存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
    

    4 回复  |  直到 18 年前
        1
  •  9
  •   sherbang    16 年前

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

    前任:

    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
  •  3
  •   user14038 user14038    18 年前

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

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

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

       example.org: 2525
       example.com: 26
    
        3
  •  2
  •   Mark Baker    18 年前

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

    类似于(未经测试):

    route_data = ${extract{1}{:}{${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}}}
    
        4
  •  1
  •   manicmethod    18 年前

    创建指定端口的新传输

    remote_hub_2525:
    driver = smtp
    port = 2525
    

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

    non_standard_hub:
    driver = manualroute
    domains = example.org : example.com
    transport = remote_hub_2525
    no_more
    
    推荐文章