Some emails content is linked to the server local address

Some emails (it seems like it’s happening to the admin emails) content is linked using the local IP address instead of the public DNS. This makes the content URL broken when opening the email from outside the company.

I.e. I am getting a" url for the embed logo on the email instead of the public DNS. So, my email is broken and not pleasant to see.

What should I check in order to fix it?

Nextcloud version (eg, 29.0.5): 28.0.6
Operating system and version (eg, Ubuntu 29.04): Debian Jammy
Apache or nginx version (eg, Apache 2.4.25): nginx 1.26.0
PHP version (eg, 8.3): PHP 8.1.28

If I log in to the nextcloud server by specifying a local address in the address bar, and send a verification email from the settings, then the logo actually has a link to the local address. If I logged in with a domain name, then the letter will contain a link to the logo with the domain name. There is no violation of logic here, as I think.
In addition, you can customize the template of the sent email message, if necessary. And there you can clearly indicate the required domain name if it is more convenient to use addresses on the local network.

I just tried to send a test mail using the function available on /settings/admin/, I did not logged off before testing but this email arrived with the correct hyperlinks. The one notifying me about some changes on the AD groups (a new user has been added…) arrived with some wrong hyperlinks.

Do you confirm I should have a look at the template customization?

I assume it is about mails that are triggered via cronjob. In this case, you can configure this with overwrite.cli.url in your config.php. And this may not be necessary if you make sure that does not appear in trusted_domains (but I’m not sure about that).