localhost in links
In some cases Nextcloud generates links to localhost instead of to the proper external url of the instance. This has been reported to happen at least in some generated emails.
I found that the overwrite.cli.url setting is set to http://localhost in config.php for some reason, even though we don't set that ourselves and according to Nextcloud docs the default is the empty string. Let's try setting that to the base url of the Nextcloud instance.