I’m not sure if you found a solution already or if you switched away from gmail at the end, but I’ve just set up my first Nextcloud server and ran into the same problem as you.
After fiddling around with certain settings and a lot of trial and error I got it running.
The only thing I have set different to you is the Encryption -> STARTTLS!
(the port is set to 587 as well, but that topic was already elaborated in this thread…).
Hope this helps you or at least some random people who stumble across the same difficulties! !
Thanks a lot for your hint!, I actually didn’t solve the issue… I tried many stuff and still doesn’t work… I’m not sure whether you meant to set STARTTLS on the Email server setup but I already did it, I’m having the same error with different e-mail providers such as web.de
I’m a little late to the party, but it might help someone…
I just wanted to say that I had the same problem as you, until I found this page and tried the suggestions from “derfreimann”. I changed the encryption from SSL/TLS to STARTTLS and Voilá, it worked!
I started out wanting to generate an “app password” but for some reason Google says that that is not possible with my account. They didn’t give any explanation though, so I have no idea why. I ended up having to enable “less secure apps” instead, which worked, but it feels bad using what Google apparently considers an “unsecure” method.
I found a Google help doc somewhere (I don’t have the link anymore) that said that to generate an “app password” you must have “2-Step Verification” enabled. I enabled 2-Step Verification, and after doing that the option appeared to generate an app password, just below “2-Step Verification” in the top “Signing in to Google” option block.
However, changing to STARTTLS and enabling less secure app access fixed my gmail SMTP problem. I have 2-Step Verification turned off and no app password at this point.
I have a different primary gmail account that is heavily used, and that gmail account is used with several apps and devices that require “less secure app access” to be turned on. I have never had any security problems with that gmail account even though less-secure access is turned on.
I had my nextcloud working with gmail, then at some point it apparently stopped working. I went through several of these threads checking that I had STARTTLS and everything else, but no joy. Then I finally went through the settings of the gmail account that I was using for outbound messages, and I noticed that my cell phone was associated with the account and gmail was using my phone as part of the authentication process. It finally occurred to me that my nextcloud installation wasn’t able to push the button on my phone when it was trying to send a message, so the access was denied. I deleted my phone # from that account and disabled all 2-factor authentication, and my nextcloud is happy again.
Hope that helps somebody else who is running into this issue. At least until Google changes the security measures again.
I managed to get it working, but it reduces security level of gmail. If you login to settings of your google account and enable access for less secure applications you can log on with starttls on port 587…
It is an old topic, but I wish to share my solution. Workaround to be honest.
After few hours trying to establish connection with google with all mentioned suggestions here (and few more), I finally give up and instead google I try outlook. With success!
Looks like google restrictions are too strong