Gmail Mail Setting

Hello! I have been looking on the forums and tried to use the imap mail feature and I cannont get Gmail to work. I’ve looked at the posts in the forums and I can’t seem to find a solution. Each time I enter the credentials nothing happens. I do have a non-Gmail account working just fine. Below is a picture of my configuration. In the password fields, I have been trying to use the google generated a one-time app password with no luck. I am on a Bluehost server using let’s encrypt certificate. Any help would be appreciated!

Hi Alan and welcome to the forum!

After reading your question, the first thing that popped to my mind, was the Enable IMAP option in your Gmail account.

Please have a look at the following Google Support Link, follow these steps and try again in Nextcloud afterwards.

Google Suppor Link: https://support.google.com/mail/answer/7126229?hl=en

Thank you! Happy to be here and thank you for your response.

I did follow the instructions on the link, and I do have IMAP Enabled but no success. The fields go gray and I an not input anything for about 30 seconds and then it goes back. I have tried several of the settings, but no luck. Is there a log I and turn on or check to see why it times out or see errors after it attempts the connection?

Hi Alan, i use this settings.

I’m having this same problem.

The Nextcloud UI for the email client isn’t so great; it tells you that it failed to communicate with the remote server, but you’re configuring 2 remote servers (SMTP and IMAP) and it doesn’t tell you which one is failing…

On G-Mail I enabled IMAP and from my Google Account settings I got an App Specific Password. In Mozilla Thunderbird I can configure things like this:

.

But when I configure the email app in NextCloud identically, it doesn’t work:

I don’t see any errors in /usr/share/webapps/nextcloud/data/nextcloud.log. Literally nothing shows up in the log file after I click the Connect button.

If I look at the Network tab in Firefox’s developer tools, I see the POST to apps/mail/api/accounts fails with status 400 Bad Request and the response payload {"message":"Creating account failed: Error connecting to mail server."}. The request payload looks OK, too:

   "accountName" : "FOO",
   "autoDetect" : false,
   "emailAddress" : "FOO@gmail.com",
   "imapHost" : "imap.gmail.com",
   "imapPassword" : "SEKRET",
   "imapPort" : 993,
   "imapSslMode" : "ssl",
   "imapUser" : "FOO@gmail.com",
   "smtpHost" : "smtp.gmail.com",
   "smtpPassword" : "SEKRET",
   "smtpPort" : 587,
   "smtpSslMode" : "tls",
   "smtpUser" : "FOO@gmail.com"
}

I followed the admin guide in the mail app’s source tree and increased the timeouts for imap (60) and smtp (20), and that didn’t help. I tried the link from the admin guide for the unlock captcha, but that seems to not apply if you’re using 2-factor auth + app specific password in GMail.


I’m using NextCloud v18.0.0 with Mail v1.0.0

More details.

I noticed @Sani provided a screenshot of a completely different section of NextCloud (Settings -> General -> Basic Settings -> Email server.

I have mine working here using Sendmail. When I configure for SMTP using GMail then I get an error that smtp.gmail.com can’t be contacted:


A problem occurred while sending the email. Please revise your settings. (Error: Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587 (Connection timed out))

Unfortunately there’s nothing of interest in the Developer Tools -> Network tab and like before, nothing shows in data/nextcloud.log

I suspect solving this error will also solve the issue in the Mail App, but I’m not really sure where to go.


I was able to setup Settings -> General -> Basic Settings -> Email server -> SMTP with a different SMTP server, so this seems to be a Nextcloud + GMail specific issue (or maybe PHP + GMail?).

So here’s something interesting… I completely disabled IPv6 on my nextcloud server and now it’s working.