Specify the remote port to use via mail through exim4

I have a Debian Etch system using Exim4. Domains are mostly local, but there are some that are remote. To handle remote mail delivery, I use the Debian configuration file:

  /etc/exim4/hubbed_hosts

This file lists the domain names and remote MX machines for delivery. For instance:

  example.org:  mx.example.com
  example.com:  mx2.example.com

Looking at the exim4 configuration file, I see that it is 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 problem is that some of the hosts that I use must send mail to a non-standard port. Unfortunately, the Debian hubbed_hosts file does not work if I try to modify it to enable the port:

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

Is it possible to dynamically allow a port to specify?

+3
source share
4

- - :

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

:

   example.org: 2525
   example.com: 26
+3

- 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

+8

Perhaps you can use the $ {extract} operator to combine port numbers and host names, as in the example in the original question.

Something like (untested):

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

create a new transport that indicates the port

remote_hub_2525:
driver = smtp
port = 2525

and then create a router for domains that require custom delivery

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

Source: https://habr.com/ru/post/1697741/


All Articles