Mail App only works once at initial setup of a new account

Simple description: Mail only arrive at initial mail account setup.

This is a very strange problem. I have nextcloud running on my own debian 9 server with postfix/dovecot mail server which works fine. I can get rainloop, roundcube, thunderbird etc working without issue but when I try to use the mail app for nextcloud, only the first setup works. I set up a new email account, it works and it downloads all messages but that’s it. New messages don’t arrive and If I try to send an email I get error 500. No error logs in either apache or nextcloud. If I check the settings for the account, the password fields are empty (not sure if they are supposed to be or not) if I enter my password again and save, the page freezes for a moment but nothing happens.

Any ideas what this could be? The only thing I can think of now is that it’s a database issue but I have no idea how to problem solve because I’m a total newbie with databases…

What i’ve tried.
Other email accounts, no difference.
Complete uninstall and reinstall of nextcloud.
Complete removal of entire virtual host in virtualmin for fresh install. Same issue every time.

Nextcloud version 16.0.4

I noticed a similar problem which I think was because I wanted to send a mail to a group with scandinavian letters in the name. The app completed the spelling for groups without these letters but faild if there was an å ä or ö in the name.

Eventually I got this working. I really can’t explain why the solution actually fixed the issue I was having but in case someone else has the same problem, I’m writing it down. It turns out my dmarc record and spf record were incorrect. After adjusting them accordingly, I started to be able to both send and receive emails from the nextcloud mail app.
It was only in nextcloud I was not able to receive or send emails so I’m assuming the nextcloud mail app makes some additional dns-query or something or validation of sorts, than for example thunderbird and the standard mail app on android. Still strange, no other settings were changed before it started working. If anyone has any idea how why, id be glad if you’d shed som light


thanks for timing the time of writing down your insights. Would you mind submitting a pull request to add this to our troubleshooting? Other admins might benefit from it.