Email not sent unless accessed via localhost

My setup fails to send emails if I access via, but works fine if I am on the server and access via https://localhost/nextcloud.
I have added ‘mail_domain’ => ‘’, to my config.php file.
If I use the sendmail settings I see nothing,even with debug switched on, just get a Email Sent message. If I use SMTP I get an error that my ISP sees SPAM Content and will not send it.

Any suggestions?



Nextcloud version (eg, 18.0.1):
Operating system and version ( Opensuse Tumbleweed):
Apache or nginx version ( Apache 2.4…41):
PHP version (eg, 7.4.3):

Can you see the mail, if the domain is wrong? Perhaps you can use ssmtp that provides more information to debug, it’s just to send mails out and lightweight.

No emails come through, nor can I found any dead.letter file. when I send an email via smtp I get the following message

Test email settings A problem occurred while sending the email. Please revise your settings. (Error: Expected response code 250 but got code “552”, with message "552 5.7.0 SPAM Content Found (VM603) ArYijadrQ6cf4ArYijbhXq ")



Then there is something inside that the other server rejects. Normally such mails go back to the sender, so then it depends on your config where it is sent to (who is the sender? can you send back mails to it, is there a fallback where undeliverable mail end up).

As I mentioned, I have no problem if I logon locally via https://localhost/nextcloud then everything works, but using I cannot send. is different from my email address.

Hope that makes sense. I cannot find any logs with unsent emails or any other errors.