Cant't connect any IMAP server from "Mail", but from Rainloop

Nextcloud version : 19.0.2
Operating system and version: Ubuntu 20.04

I cannot get Mail to work. On the configuration screen I get “Creating account failed: Could not connect to IMAP” (There is not more info in the Settings->Log Screen either)

I tried to setup a Gmail account (with one time password) and a completely different IMAP server (Protonmail Bridge) with all possible combinations of encryption (SSL/TLS and STRATTLS), without any luck.

I then installed RainLoop to crosscheck and was able to connect both accounts without a problem.

This leads me to believe that the Mail app has an issue (or are there more configuration options I do not know about?).

I extensively searched the web and this forum to no avail, so any help would be greatly appreciatetd!

Thanks

Try to reproduce one more time, but open the browser dev console. Then inspect the request that has the error (HTTP 4xx return code IIRC) and share a screenshot of the response JSON.

Hi Christoph
Thanks for your message. Is this the right info?
(The response code was cut, it is:
[HTTP/1.1 400 Bad request 505ms]
)

It is. Your server can’t connect to the SMTP host. Try increasing the timeout values https://github.com/nextcloud/mail/blob/master/doc/admin.md#smtp-timeout

I added the following two lines to my config.php:
‘app.mail.imap.timeout’ => 40,
‘app.mail.smtp.timeout’ => 20,

restarted apache (just to be sure) and reloded the email config page. Did not work… But it took only a couple of seconds (ca. 6) before the error message came, so probably it is not the timeout?
I got a new error message though:
“Creating account failed: 4.7.0 Try again later, closing connection.”
This was trying to connect to gmail servers (imap with SSL/TLS, smtp with STARTTLS)
I also tried connecting from a command line on the server with the command “openssl s_client -connect imap.gmail.com:993”, which worked, so the server should be reachable.

Yes, if you get the error quickly with a long timeout set then it’s likely not a problem with that.

Any other ideas? I am experiencing the same problem. The mail app gets stuck on “Loading Messages” here is a screencap with dev console on.

And just like OP using Rainloop the messages loaded fine. By the way this is version Nextcloud 20.0.1 and Mail 1.5.1

I just realized my issue might be different than OP the error I am getting is not related to auth.

Hi Alex
After trying quite a while and not getting anywhere, I took the nuclear option and I am now running my own mailserver (mailinabox). Everything works now…
I know, hardly qualifies as a solution :wink:

1 Like

I have the same issue. When i upgraded from 19.0.4 to 20.0.1(today) mail app was working fine after a while i saw an update to mail app to v1.5.1,
Great i say lets update it.

After update i go to mail tab, asks for password again, Ok no problem.
i create new app password on outlook and login.
Stuck on loading messages.

Deleted the mail account, run “occ mail:clean-up”, disabled and removed app, reinstalled, added the account again, but i still get “Loading messages”.

Opened the database with pgAdmin, the account is added, but no new messages appear on the db.
Tried running “occ mail:account:sync 10 -f” (my current account id) and got:

[debug] account is up to date, skipping mailbox sync

In MailboxLockedException.php line 33:

331 is already being synced

After 3 hours i still get “331 is alerady being synced” so it doesn’t do anything…

Just to verify it, i also have a second docker for tests, I fire up the second docker.
Already on 20.0.1, Mail working, update to 1.5.1 mail broke.

Now i’m thinking about it… I should begin a new post, so its not mixed up with the OP issue.

Thanks for the reply. After this experience, I am fairly turned off by NextCloud in general. I came in with fairly high h expectations, and in general, I am pretty disappointed. Ohh well, that is how Open Source sometimes goes.

1 Like

I’ve said it before and I’ll say it again: the locked mailbox is not an error. I’m sure you’ll understand the concept of locking in software. we need this to prevent conflicts of concurrent requests. If your mailbox is stuck being locked, some other error occurred that prevent the release of the lock.

Take a closer look at your nextcloud.log. If there was an error, it’s logged there 99% of the time.

Again, the locked mailbox is just a symptom. It’s not the problem.

I have the same problem, Mail cannot connect to my IMAP server, which is an external commercial provider, Thunderbird can use it fine and I am using the same settings. In the dev console I get an error about the mailbox being locked. I saw the following error in the nextcloud logs in case it is relevant. With log level set to info I don’t see anything else from Mail. This might have appeared after I tried inputting my mail server settings again.

[index] Error: Exception: Argument 1 passed to OCA\Mail\Service\Quota::__construct() must be of the type int, float given, called in /var/www/nextcloud/apps/mail/lib/Service/MailManager.php on line 468 at <<closure>>

0. /var/www/nextcloud/lib/private/AppFramework/App.php line 152
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Controller\AccountsController {}, "getQuota")
1. /var/www/nextcloud/lib/private/Route/Router.php line 309
   OC\AppFramework\App::main("OCA\\Mail\\Cont ... r", "getQuota", OC\AppFramework\ ... {}, {id: "1",_route: ... "})
2. /var/www/nextcloud/lib/base.php line 1008
   OC\Route\Router->match("/apps/mail/api/accounts/1/quota")
3. /var/www/nextcloud/index.php line 37
   OC::handleRequest()

GET /nextcloud/index.php/apps/mail/api/accounts/1/quota
from XXXXXXX by XXXXX at 2021-03-24T08:12:15+00:00

read my reply before yours.

yes it might be, please create a new bug reports with the full log line from nextcloud.log.