Gmail SMTP Email Server config

Hey dedero!

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! :slight_smile:!

Cheers,
Christian

Hi Christian,

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

Thanks and cheers,
Bruno.

Hi Bruno!

Well that is weird, because as far as I’m understanding from the thread here our settings seem to be identical… except maybe that I’m using the latest Nexctcloud version, 15.0.4.

Sorry I couldn’t help you out, that’s a bit of a bummer :expressionless:

Cheers,
Christian

1 Like

Hi, I’m actually using the 15.0.4 version… yeah, it’s really strange… I’m planning to upgrade my hardware and perform a clean installation soon, let’s see then!

Thanks a lot for sharing your experience :+1:

Cheers,
Bruno.

Hello!
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.

Thanks for the tip @derfreimann!

Petter

PS. I forgot to mention that I’m using NextcloudPi v. 1.14.3 / Nextcloud v. 16.0.2.1 DS.

1 Like

This worked for me as well. Thanks for your post!

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.

enabling less secure apps in my gmail account worked for me

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.
/dwight

1 Like

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…

1 Like

Sorry i so lazy to write an explanaion .

Screen Shot 2021-12-09 at 18.32.40

Screen Shot 2021-12-09 at 18.35.00

2 Likes

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 :slight_smile:

Hi @batvase, in my case Gmail works :
image

You just have to enable this option (in security menu : https://myaccount.google.com/security) on your google account : less secure access to applications (or something like that) https://myaccount.google.com/lesssecureapps

1 Like

Not sure if you sorted this out, but I managed to fix this using STARTLS and generating a gmail app password.

@pete1
Thanks for the link. I too got it working but could not get it working with STARTTLS and instead needed SSL/TLS as shown in @Mageunic 's settings above.

I know its been awhile since you posted this however I just wanted to shine some light on your settings for better knowledge. I’ve tested these on my own server and confirmed these settings work.

Traditionally for port 465 – this is considered by standards an all encrypted port - encryption is implied immediately during the handshake and for the sending of data. Hence for port 465 you want to use SSL/TLS

For port 587 - the initial handshake takes place unencrypted and the the capabilities are upgraded to an encrypted connection. For most services 587 is usually considered the gold standard. For port 587 you want to choose STARTTLS since you’re requesting to “START a TLS connection” after initially connecting over an unencrypted channel. Some consider this “upgrading” the request.

Hopefully that helps.

1 Like

Thanks @Petter_Nordgren
I used STARTTLS encryption and I also used “Gmail application password” to make it work.
https://support.google.com/accounts/answer/185833