Gmail SMTP Email Server config

Hello All,

I’m trying to configure the Email server using Gmail under Admin console in Nextcloud 13 but it doesn’t work and the logs are not showing anything:

I’m using the supposed correct Gmail IMAP/SMTP configuration but no luck: Check Gmail through other email platforms - Gmail Help

And there is no clear error output “From address” and “Credentials” field are blanked but I’m using my actual e-mail address to login:

I’m also using the Administration manual configuration as guideline: https://docs.nextcloud.com/server/13/admin_manual/configuration_server/email_configuration.html

Any ideas here or any other way to check the logs further?

Thanks a lot!

  • ssl/tls connections via smpt.gmail.com should use port 587, did u try this one as well?
  • plus: have you granted access to use imap/pop to your gmailbox in your gmail-account?

aww and why not trying use the search-function in our nice forum first? --> Unable to connect to Gmail

Hi, thanks for your reply.

As you don’t know me I would like to give some details about me. Being a very active forum user in many different topics, not only for asking but also posting experiences from trips, car maintenance, photography, etc… now being a frequent reader for almost 1 year now, I’m not a post creator due to the very useful search function on this nice forum, so as I didn’t find my actual issue, I decided to post.

I understand that many people just post in forums without even saying hello, introduction or searching but I don’t really see the need of being ironic or sarcastic replying a topic which have not been iniciated in a rude or unrespectful way.

So after my disclaimer, I will answer your suggestions:

  • Yes, I already tested (before my post) the 587 and it shows the same error message
  • Yes, I granted access to use imap to my gmail account, I actually did it for the “mail” Nextcloud app and it works and still working fine
  • replying to your unnecesary ironic question, I found that post you are linking but it didn’t help, I tried everything shown there and the thing is that post is orientated when the mail app Nextcloud client is not working and is not my case, in my case the “email server” function is not working.

Thanks and cheers,
Bruno

hey bruno,
pls don’t be too pissed as i am going to apologize for having threatening you with wrong suspects. it wasn’t my intention to make you mad. from my viewpoint a majority of ppl isnt really using this search- function. so please take my honest excuses for having thought bad of you.

and i wan’t ironic or even less sarcastic with you… i was just trying to make a small remark about using the search-function, tongue-in-cheek :wink:

i spare you with questions like: did you try port 587 using starttls from the dropdown… as i’m sure now you have played through all possibilities.

i have 2 more hints for you:

  • pls make sure that your provider (of your server) isn’t blocking port 587
  • i hope it’s not related to self-signed (or wrong signed) ssl-certificates.

good luck
jimmy

Hi Jimmy, thanks for clarifying, I totally understand your approach because some users can be annoying. I just wanted to clarify my point of view and which kind of forum user I am.

  • Yes, I also tried using port 587 using STARTTLS from the dropdown
  • The ISP thing it’s a good point, but I guess it doesn’t because I can use the mail app connected to gmail and I use SMTP and IMAP in there unless the mail app connects to gmail in any other way, for example this is my mail configuration (I mean the app) which works fine, and I’m trying to configure the same account for the admin mail:
    image

While I was writing this reply it came to my mind whether using the same account for the mail app and the admin mail could make some conflict between them (even though it shouldn’t) so I removed that account from the mail app and still not working showing the same error message

  • I didn’t fully get the certificate part, you mean for the domain that I’m actually using for the my Nextcloud?, if so, I’m not using a self-signed certificate, I’m actually using one from Let’s encrypt.

Thanks and cheers,
Bruno.

so this is getting tricky now…

am i right and you have installed your sever with an ISP?

basically, google is smart and treats logins from different geographical locations with different security restrictions (blocks)… so this could be another reason
so there was big hint on the net that you can “unlock” or re-auth your google account with the following url:
https://accounts.google.com/UnlockCaptcha
and of course you should do that from your ISP

hope that’s gonna work for you, now

Actually not, I mean with ISP my internet provider (Vodafone DSL) and I have installed my nextcloud locally at home.

Thanks for the UnlockCaptcha url, I used it before but I didn’t remeber to try now with that, but I tried with no luck

I found something interesting in the nextcloud.log (I assume my fault for not looking at in the very begining and I feel like “did you check if the pc is plugged in the power socket?”)

It seems there is some certificate validation error as you mentioned before but I’m still looking in google what does it means but I need to look deeper:

{“reqId”:“j0M8HXBraQ0siCsLWWXB”,“level”:3,“time”:“2018-06-19T16:10:19+02:00”,“remoteAddr”:“XXX.XXX.XXX.XXX”,“user”:“XXXXXX”,“app”:“PHP”,“method”:“POST”,“url”:"/settings/admin/mailtest",“message”:"stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at /var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php#94",“userAgent”:“Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36”,“version”:“13.0.4.0”}

Any ideas??

Thanks and cheers,
Bruno.

do you run ipv6 and ipv4 at the same time? or even only ipv4?

anyways… try pinging smtp.gmail.com for it’s ip-adress and use it on your setup. or use the url given in the answer… maybe that helps

it got harder to get gmail as a smtp now because of security reasons,
You have to go to gmail.com and allow third party apps to allow connection to your account, or to create app password.
Gmail prefer in order first 465 then 578 for SMTPS port

@JimmyKater I’m actually using ipv4 only, I tried also with the ip address and no luck…

@Nemskiller thanks for the info… it seems I need to find some other email provider with less security restrictions. Actually I created an apps password before deactivating 2fa auth for testing but now with no 2fa activated doesn’t work either… quite strange

well… web and gmx work flawlessly

1 Like

I’ve tested Outlook.com (Microsoft) without problems too,

Gmail worked well some years before, but it’s a hard way to make it work now. The security settings change all the time…

At the moment i have one client who works with that.

2 Likes

I tried using web.de smtp server and still showing the same certificate error as for gmail! :triumph:

I will dig a bit on google and post any result if any…

thanks for your help!

one last question… the email setup is for admins, right? have you put a valid emailadress at your (normal) users email?

Another question does your serveur have the good date/time ?

Is your problem related to this?
https://github.com/nextcloud/server/issues/7421

1 Like

@JimmyKater yes correct, I want to configure it for admin messages like password reset and I want also activate registration
@Nemskiller yes, I have the NTP server from Germany configured
@MeiRos actually yes, thanks for the info, I was taking a look at that post yesterday as well so it seems my problem is due to I have installed PHP 7.1 instead of 7.2, it seems in 7.2 this issue is solved and also will be solved in Nextcloud 14. The solution there which states hardcoding the usage of TLS 1.2 in swiftmailer (/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php) doesn’t work in my case…

During my Nextcloud 13 implementation I decided to install PHP 7.1 because 7.2 didn’t have a fully working php-smbclient at that moment but now the impact is in the mails delivery :weary: , I would need to see whether is easier to upgrade to 7.2 or wait for NC14

Thank you all for your help :+1:

OK, more news… but no solution

  • updated PHP to 7.2 keeping the original swiftmailer configuration --> still doesn’t work
  • updated PHP to 7.2 forcing swiftmailer to use TLS 1.2 --> still doesn’t work
  • both above situations are being tested not only with a gmail account but also with a web.de mail account

I’m lost in the universe now, no idea what else to do… just waiting until NC14 is going to be launched

Cheers,
Bruno.

1 Like

Not a great solution but in the meantime you could set up a Postfix mail relay as a workaround.

Have you made sure the GMAIL account has been enabled to allow “less secure apps”
https://support.google.com/accounts/answer/6010255?hl=en

Gerard