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

发布于 2024-07-05 17:51:44 字数 890 浏览 9 评论 0原文

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

Is it possible todynamicly allowed the port to be specified?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

巨坚强 2024-07-12 17:51:44

这实际上是默认支持的,无需对 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

This is actually supported by default without any changes to your exim4 config.

In hubbed_hosts, you separate hosts with a colon, and you specify a port number with a double-colon.
EX:

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

For more info check out http://www.exim.org/exim-html-current/doc/html/spec_html/ch20.html#SECID122

别忘他 2024-07-12 17:51:44

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

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

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

   example.org: 2525
   example.com: 26

I was hoping for something a little more dynamic - and this solution works:

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

Then a simple file may have a list of ports on a per-domain basis:

   example.org: 2525
   example.com: 26
薔薇婲 2024-07-12 17:51:44

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

像(未经测试)的东西:

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

You could probably use the ${extract} operator to let you combine the port numbers and host names, like in the example in your original question.

Something like (untested):

route_data = ${extract{1}{:}{${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}}}
萝莉病 2024-07-12 17:51:44

创建指定端口的新传输

remote_hub_2525:
driver = smtp
port = 2525

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

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

make a new transport that specifies the port

remote_hub_2525:
driver = smtp
port = 2525

and then create a router for the domains needing non-standard delivery

non_standard_hub:
driver = manualroute
domains = example.org : example.com
transport = remote_hub_2525
no_more
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文