Hi @Andre g,
DNS resolves correctly, to internal ip
but if I use the mail server public name I can't connect at all
Can you share some more details on your DNS settings?
If your mail server public name is mail.contoso.com, you need a A or CNAME record to point mail.contoso.com to the internal ip of Exchange.
If the client device which is having the issue is not domain-joined, is it using the same DNS server in your internal network as other domain-joined ones?
If it is using another DNS server, you need to make sure mail.contoso.com can be resolved correctly on that server.
(And if it is a public DNS server, you need to point mail.contoso.com to the public ip address of Exchange or firewalls in front of it)
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.