[exim] Error: TCP port "" is not defined

Top Page
Delete this message
Reply to this message
Author: Alex Schuurman
Date:  
To: exim-users
Subject: [exim] Error: TCP port "" is not defined
On our Exim 4.62 server we're experiencing a problem with relaying mail
to another mailserver. This problem occurs ONLY when the following
conditions are met:

- The mail that is sent has more recipients on the same domain (So, more
than one To, or a CC on the same domain)
- The mail has no recipients with local mailboxes

It seems that the repeated MySQL lookup for the port fails (The
hostname/IP and port for the receiving mailserver needs to be found in a
MySQL database). A message with a single recipient or when a copy of the
message needs to be delivered to a local mailbox, instead of being
relayed, the problem doesn't occur.

The following error message indicates that Exim can't query the port
where needs to be relayed to.

/var/log/exim/exim_main.log:
== alias1@??? <alias1@???> R=mailrelaysql T=pipe_remote
defer (-1): TCP port "" is not defined for pipe_remote transport
== alias2@??? <alias2@???> R=mailrelaysql T=pipe_remote
defer (-1): TCP port "" is not defined for pipe_remote transport


The following router is used in exim.conf:

mailrelaysql:
driver = accept
transport = pipe_remote
condition = ${if eq{$domain}{${lookup mysql {SELECT domein FROM
domains WHERE domain='$domain' AND relay_on='1' LIMIT 0,1}}}{yes}{no}}
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8

The following transport is used in exim.conf:

pipe_remote:
driver = smtp
hosts = ${lookup mysql{SELECT relay_ip FROM domains WHERE
domain='$domain'}}
port = ${lookup mysql{SELECT relay_port FROM domains WHERE
domain='$domain'}}
allow_localhost
hosts_override

Any tips how we can solve this problem?