Nextcloud Email with Gmail Relay
-
I have Cloudron set up to send emails via Gmail. The emails work perfectly for the Cloudron itself and for other apps like Matrix. But I cannot seem to get it to work for Nextcloud. The only way I can get email to work this way is if I manually change the email settings in Nextcloud, which then get overwritten on any app restart. This post indicates that I should just leave things as is. But I suspect that it is only if I use Cloudron to manage the email, which I can't. Am I missing something?
-
@eganonoa are you generally referring to transactional emails sent out from Nextcloud or the mail client plugin for Nextcloud?
If other apps can send out mails Nextcloud should be able to do as well, since it uses the same infrastructure then. -
@nebulon Transactional emails. It is working for all other apps, but not Nextcloud for some reason. I've tried things like Calendar invites, user emails, etc. And it just fails each time. I need to go in manually to put the actual SMTP information for Gmail and then, of course, it works (and indeed things that have been held back like old activity notifications go out!). But that gets overwritten on app restart.
Everything works perfectly on all other apps managed by Cloudron as far as I can tell. So it has to be something within the Nextcloud setup.
-
@eganonoa given that I cannot reproduce this, I suspect some Nextcloud plugin installed in your instance interferes here. Also note that the Nextcloud configs should not have anything related to gmail set, since mails would be sent out locally through the system and only the system should know about the relay.
Can you check which plugins you have installed and maybe disable them. Then restart the app and check again?
-
@nebulon thanks. I think you are right it is related to some app or another. I just did a clean install of a nextcloud server under a different domain and it works perfectly. So there has to be some app that is doing this. i've not installed many, so it shouldn't be too hard to figure out.
-
@nebulon I figured it out! When the app restarts it overwrites nearly all, but crucially not all, email settings. The encryption protocol is not overwritten. So if, like me, you had at some point played around and, in so doing, changed encryption from None to SSL/TLS or STARTLS that will be saved even after a reboot and will, subsequently, cause the Cloudron-managed email to fail. I never picked that up across multiple restarts because I did not know the default Cloudron email settings. Once I created a new dummy Nextcloud instance i was able to compare and see the difference in the encryption protocol.
Thanks for responding so quickly on this!
-
@nebulon It's the email encryption protocol, where you can choose either None, SSL/TLS, or STARTLS. In config.php it is:
'mail_smtpauthtype' => 'PLAIN'
That is not referred to in the Nextcloud-App's start.sh file, which results in it not reverting to plain if some idiot like myself went and changed that in the Nextcloud Basic Settings area!