Configure Exim for outbound remote mail problem

Mr. Jinx

Verified User
Joined
May 5, 2006
Messages
57
I have configured Exim to use a remote outbound mail server. As mail service, I make use of mxroute.com.

Followed this very nice tutorial:

The problem is something goes wrong when the remote smtp server is resolved to an IPv6 address.

In /etc/exim.routers.pre.conf I have this line:
Code:
route_list = * smtp.example.com::587

Sending an email, I get this error:
Code:
Connecting to smtp.example.com [2a01:xxx:xxx:xxxx::2]:587 ...  connected
  SMTP<< 220 smtp.example.com ESMTP Exim 4.94.2 Mon, 02 Aug 2021 16:22:20 +0000
  SMTP>> EHLO myserver.com
  SMTP<< 250-smtp.example.com Hello myserver.com [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]
         250-SIZE 52428800
         250-8BITMIME
         250-PIPELINING
         250-PIPE_CONNECT
         250-AUTH PLAIN LOGIN
         250-STARTTLS
         250 HELP
  SMTP>> STARTTLS
  SMTP<< 220 TLS go ahead
  SMTP>> EHLO myserver.com
  SMTP<< 250-smtp.example.com Hello myserver.com [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]
         250-SIZE 52428800
         250-8BITMIME
         250-PIPELINING
         250-PIPE_CONNECT
         250-AUTH PLAIN LOGIN
         250 HELP
LOG: host_lookup_failed MAIN
  no IP address found for host 2a01
  SMTP>> MAIL FROM:<> SIZE=2946
  SMTP>> RCPT TO:<[email protected]>
  SMTP>> DATA
  SMTP<< 250 OK
  SMTP<< 550 relay not permitted, authentication required
  SMTP<< 503-All RCPT commands were rejected with this error:
         503-relay not permitted, authentication required
         503 Valid RCPT command must precede DATA
  SMTP>> QUIT

The weird part is "no IP address found for host 2a01" and after that it fails authentication.
It seems the first octet of the IPv6 address is being used instead of the complete IPv6 address?

If I replace the FQDN in /etc/exim.routers.pre.conf with an IPv4 address like this:
Code:
route_list = * 100.100.100.100::587
... then it works fine!

So any idea's how to make the route_list accept FQDN's that resolve to a proper IPv6 address?
 
Square brackets because of the colons in ipv6. ?

  • When IPv6 addresses are involved, it gets worse, because they contain colons of their own. To make this case easier, it is permitted to enclose an IP address (either v4 or v6) in square brackets if a port number follows. For example:
    route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"


@DA moderators please add this in the DOCS?
 
Last edited:
I tried the square brackets, but it does not seem to work when using FQDN:

With one colon:
Code:
route_list = * [smtp.example.com]:587
Error: no IP address found for host [smtp.example.com]

With double colons:
Code:
route_list = * [smtp.example.com]::587
Error: no IP address found for host 2a01

:rolleyes:
 
I tried the square brackets, but it does not seem to work when using FQDN:

With one colon:
Code:
route_list = * [smtp.example.com]:587
Error: no IP address found for host [smtp.example.com]

With double colons:
Code:
route_list = * [smtp.example.com]::587
Error: no IP address found for host 2a01

:rolleyes:
In above example exim.org the square brackets for IPv6 adress itself. ;)

the smtp... is no fqdn the hostname itself should be FQDN but there i can be very wrong????

Do first some dns / ns test online for those hostname / servers you need there

and did you connect the ipv6 in admin with the ipv4 pointing or so i don't know exactly now.
 
Last edited:
Using the literal IPv6 address in square brackets works, just like the IPv4 address.
However, this gives a minor error:
Code:
SSL verify error: certificate name mismatch:

That's why I wanted to use the FQDN, which works if it would only resolve to IPv4. But Exim seems to have problems with IPv6.
No big deal though.. but weird that I couldn't find any other reports about this problem.
 
Using the literal IPv6 address in square brackets works, just like the IPv4 address.
However, this gives a minor error:
Code:
SSL verify error: certificate name mismatch:

That's why I wanted to use the FQDN, which works if it would only resolve to IPv4. But Exim seems to have problems with IPv6.
No big deal though.. but weird that I couldn't find any other reports about this problem.
Yup problems with yes<> no FQDN and mismatch x509 .. don't know or same cause here topic from 15 July
 
I have a workaround, in case someone else experience the same problem with IPv6 external SMTP host and Exim.

In exim.routers.pre.conf replace:
Code:
ignore_target_hosts = 127.0.0.0/8
with:
Code:
ignore_target_hosts = <; 0000::0000/0 ; 127.0.0.0/8

This will force the domainname to be resolved as IPv4 address.
 
Back
Top