Nextcloud Mail issues
-
Strange, but Nextcloud Mail suddenly stopped working:
[index] Ошибка: Error connecting to mail server. GET /apps/mail/api/accounts/1/quota на 31.173.80.134 от vladislav в 15 окт. 2025 г., 18:56:28
[mail] Ошибка: Cron mail sync failed for account 1 на ? от -- в 15 окт. 2025 г., 19:40:48
If I connect from external apps like Thunderbird Mobile, everything works as expected. Snappy Mail app also works fine.
But when I try to log in to the mail server from Nextcloud Mail (both the latest version and 5.4.0), this error appears in the Mail log:Oct 15 19:58:45 [NOTICE] [FF7E0883-2134-4B12-8030-062F0017AB0A] [core] connect ip=158.94.209.47 port=58086 local_ip=172.18.30.4 local_port=2587 Oct 15 19:58:45 [INFO] [FF7E0883-2134-4B12-8030-062F0017AB0A] [dns-list] Oct 15 19:58:46 [INFO] [FF7E0883-2134-4B12-8030-062F0017AB0A] [helo.checks] helo_host: User, pass:bare_ip, rdns_match(org_dom), host_mismatch, literal_mismatch, fail:valid_hostname(no_dot), skip:dynamic(no dots) Oct 15 19:58:46 [INFO] [FF7E0883-2134-4B12-8030-062F0017AB0A] [spf] identity=helo ip=158.94.209.47 domain="User" mfrom=<postmaster@User> result=None Oct 15 19:58:46 [INFO] [FF7E0883-2134-4B12-8030-062F0017AB0A] [spf] scope: helo, result: None, domain: User Oct 15 19:58:46 [INFO] [FF7E0883-2134-4B12-8030-062F0017AB0A] [limit] concurrent_count: 1, concurrent: 1/200, rate_conn: 1:60/1m, unrec_cmds: AUTH,LOGIN Oct 15 19:58:46 [NOTICE] [FF7E0883-2134-4B12-8030-062F0017AB0A] [core] disconnect ip=158.94.209.47 rdns=NXDOMAIN helo=User relay=N early=N esmtp=Y tls=N pipe=N errors=1 txns=0 rcpts=0/0/0 msgs=0/0/0 bytes=0 lr="500 Unrecognized command" time=1.391
I’m not sure if this is somehow related to the Docker image migration, but I didn’t do anything else with Cloudron today.
-
Well… I’m out of ideas. Here’s what I’ve tried to fix this problem (from easy to hard):
- Restarted the mail service
- Turned incoming mail off and on for my domain
- Re-saved the mail domain settings (didn’t change anything, just clicked “Save”)
- Synced DNS
- Renewed certificates
- Regenerated the Mail app password
- Ran cloudron-support --recreate-containers
- Ran cloudron-support --recreate-docker
Here’s what I tried to check if IMAP is working at all:
- Connected from Thunderbird client → works
- Connected from Snappy Mail installed on the same server → works
- Connected from an external Nextcloud instance with the latest Mail app installed → works!
- Installed a new Nextcloud app on my server and tried connecting from its Mail app → doesn’t work
From what I can see in my old Nextcloud logs, IMAP errors started appearing yesterday, while I wasn’t doing anything with either Nextcloud or Cloudron.
I know that Mail app from Nextcloud isn't the best deal, but for now I'm really concerned that the IMAP connection doesn’t work just between two Docker containers.
-
Well… I’m out of ideas. Here’s what I’ve tried to fix this problem (from easy to hard):
- Restarted the mail service
- Turned incoming mail off and on for my domain
- Re-saved the mail domain settings (didn’t change anything, just clicked “Save”)
- Synced DNS
- Renewed certificates
- Regenerated the Mail app password
- Ran cloudron-support --recreate-containers
- Ran cloudron-support --recreate-docker
Here’s what I tried to check if IMAP is working at all:
- Connected from Thunderbird client → works
- Connected from Snappy Mail installed on the same server → works
- Connected from an external Nextcloud instance with the latest Mail app installed → works!
- Installed a new Nextcloud app on my server and tried connecting from its Mail app → doesn’t work
From what I can see in my old Nextcloud logs, IMAP errors started appearing yesterday, while I wasn’t doing anything with either Nextcloud or Cloudron.
I know that Mail app from Nextcloud isn't the best deal, but for now I'm really concerned that the IMAP connection doesn’t work just between two Docker containers.
@WiseMetalhead it's most likely an issue with the Nextcloud Mail app and nothing to do with Cloudron.
-
@WiseMetalhead it's most likely an issue with the Nextcloud Mail app and nothing to do with Cloudron.
@jdaviescoates The same app on an external server connects to my IMAP without any issues. I also tried installing older versions of the Mail app on my new Nextcloud (ones that I know used to work before
).
-
@nebulon said in Nextcloud Mail issues:
So SnappyMail or Roundcube on the same Cloudron still work fine?
Yes, Roundcube is also working just fine.
-
Then it all points to Nextcloud to be honest. Are there any more error or debug logs from Nextcloud available when it fails?
@nebulon said in Nextcloud Mail issues:
there any more error or debug logs
Here’s all I could find in the logs:
2025-10-16T11:32:21Z 212.152.**.*** - - [16/Oct/2025:11:32:16 +0000] "POST /apps/mail/api/accounts HTTP/1.1" 400 104 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
{"reqId":"B2gTLx5mgFvdhfASC2sM","level":3,"time":"2025-10-16T10:07:35+00:00","remoteAddr":"212.152.**.***","user":"vladislav","app":"index","method":"GET","url":"/apps/mail/api/accounts/1/quota","message":"Error connecting to mail server.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36","version":"31.0.9.1","exception":{"Exception":"Horde_Imap_Client_Exception","Message":"Error connecting to mail server.","Code":11,"Trace":[{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":375,"function":"_connect","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/app/data/apps/mail/lib/IMAP/HordeImapClient.php","line":60,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"OCA\\Mail\\IMAP\\HordeImapClient","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":1404,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/lib/IMAP/FolderMapper.php","line":52,"function":"listMailboxes","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/app/data/apps/mail/lib/Service/MailManager.php","line":594,"function":"getFolders","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->"},{"file":"/app/data/apps/mail/lib/Controller/AccountsController.php","line":470,"function":"getQuota","class":"OCA\\Mail\\Service\\MailManager","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"getQuota","class":"OCA\\Mail\\Controller\\AccountsController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/app/code/lib/base.php","line":1063,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/app/code/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":607,"message":"Error connecting to mail server.","exception":{"details":"[110] Connection timed out","logged":false,"raw_msg":"Error connecting to mail server."},"CustomMessage":"Error connecting to mail server."}} {"reqId":"V6QGeCfvi4X7PdvxiDiE","level":3,"time":"2025-10-16T10:07:26+00:00","remoteAddr":"212.152.**.***","user":"vladislav","app":"mail","method":"GET","url":"/apps/mail/","message":"Could not load account mailboxes: IMAP error synchronizing account 1: Error connecting to mail server.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36","version":"31.0.9.1","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"IMAP error synchronizing account 1: Error connecting to mail server.","Code":11,"Trace":[{"file":"/app/data/apps/mail/lib/Service/MailManager.php","line":139,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/lib/Controller/PageController.php","line":154,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/app/code/lib/base.php","line":1063,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/app/code/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/data/apps/mail/lib/IMAP/MailboxSync.php","Line":110,"Previous":{"Exception":"Horde_Imap_Client_Exception","Message":"Error connecting to mail server.","Code":11,"Trace":[{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":375,"function":"_connect","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/app/data/apps/mail/lib/IMAP/HordeImapClient.php","line":60,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"OCA\\Mail\\IMAP\\HordeImapClient","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":1404,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/lib/IMAP/FolderMapper.php","line":52,"function":"listMailboxes","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/app/data/apps/mail/lib/IMAP/MailboxSync.php","line":107,"function":"getFolders","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->"},{"file":"/app/data/apps/mail/lib/Service/MailManager.php","line":139,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/data/apps/mail/lib/Controller/PageController.php","line":154,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/app/code/lib/base.php","line":1063,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/app/code/index.php","line":24,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/data/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":607},"message":"Could not load account mailboxes: IMAP error synchronizing account 1: Error connecting to mail server.","exception":{},"CustomMessage":"Could not load account mailboxes: IMAP error synchronizing account 1: Error connecting to mail server."}}
-
So the connection times out apparently.
Can you open a webterminal into the nextcloud app and run those two checks for IMAP connection:
telnet mail 9993 telnet <yourpublicmaildomain> 993
Are those connecting? If so, it is some issue in the Nextcloud mail app then.
-
So the connection times out apparently.
Can you open a webterminal into the nextcloud app and run those two checks for IMAP connection:
telnet mail 9993 telnet <yourpublicmaildomain> 993
Are those connecting? If so, it is some issue in the Nextcloud mail app then.
@nebulon said in Nextcloud Mail issues:
telnet mail 9993
root@71780ea5-011c-4c09-886e-5f7e17e0b670:/app/code# telnet mail 9993 Trying fd00:c107:d509::2... Connected to mail. Escape character is '^]'. Connection closed by foreign host.
@nebulon said in Nextcloud Mail issues:
telnet <yourpublicmaildomain> 993
root@71780ea5-011c-4c09-886e-5f7e17e0b670:/app/code# telnet my.***.ru 993 Trying 172.18.0.1... telnet: Unable to connect to remote host: Connection timed out
-
Then at least the local connection between the containers work fine. Is port 993 even publicly open on your system?
Also please run https://docs.cloudron.io/troubleshooting/#troubleshooting-tool to get some basic overview there.
@nebulon said in Nextcloud Mail issues:
Is port 993 even publicly open on your system
Yes, of course. I also can connect from a remote machine:
vladislav@MINIPC:~/git$ telnet my.***.ru 993 Trying 91.214.***.***... Connected to my.***.ru. Escape character is '^]'. Connection closed by foreign host.
cloudron-support --troubleshoot
wisemetalhead@lvhome:~$ sudo cloudron-support --troubleshoot [sudo] password for wisemetalhead: Vendor: AZW Product: ME mini Linux: 6.14.0-33-generic Ubuntu: noble 24.04 Processor: Intel(R) N150 BIOS Intel(R) N150 To Be Filled By O.E.M. CPU @ 2.8GHz x 4 RAM: 12001808KB Disk: /dev/mmcblk0p2 48G [OK] node version is correct [FAIL] Server has an IPv6 address but api.cloudron.io is unreachable via IPv6 (ping6 -q -c 1 api.cloudron.io) Instead of disabling IPv6 globally, you can disable it at an interface level. sysctl -w net.ipv6.conf.enp1s0.disable_ipv6=1 sysctl -w net.ipv6.conf.enp2s0.disable_ipv6=1 For the above configuration to persist across reboots, you have to add below to /etc/sysctl.conf net.ipv6.conf.enp1s0.disable_ipv6=1 net.ipv6.conf.enp2s0.disable_ipv6=1 wisemetalhead@lvhome:~$ sudo sysctl -w net.ipv6.conf.enp1s0.disable_ipv6=1 net.ipv6.conf.enp1s0.disable_ipv6 = 1 wisemetalhead@lvhome:~$ sudo sysctl -w net.ipv6.conf.enp2s0.disable_ipv6=1 net.ipv6.conf.enp2s0.disable_ipv6 = 1 wisemetalhead@lvhome:~$ sudo cloudron-support --troubleshoot Vendor: AZW Product: ME mini Linux: 6.14.0-33-generic Ubuntu: noble 24.04 Processor: Intel(R) N150 BIOS Intel(R) N150 To Be Filled By O.E.M. CPU @ 2.8GHz x 4 RAM: 12001808KB Disk: /dev/mmcblk0p2 48G [OK] node version is correct [OK] IPv6 is enabled in kernel. No public IPv6 address [OK] docker is running [OK] docker version is correct [OK] MySQL is running [OK] nginx is running [OK] dashboard cert is valid [OK] dashboard is reachable via loopback [OK] box v8.3.2 is running [OK] netplan is good [OK] DNS is resolving via systemd-resolved [OK] Dashboard is reachable via domain name [WARN] Domain ***.ru expiry check skipped because whois does not have this information [OK] unbound is running
-
BTW, just for the record, I don't really use the Nextcloud Mail app (5.5.7), but do have it installed and it's working fine for me.... but I'm just about to update it to 5.5.10... still working fine.
-
Ah right that keeps getting me, so from within the container the my.domain.com would resolve to the local system and thus as you can see in the logs, it tries to contact
172.18.0.1
on port 993 which won't work. There you can only contact via port 9993 which is then bound to the mail container. So all you should have to do is to configure nextcloud mail to use that port instead of 993.Port 993 is routed via the external interface to the internal mail container 9993.
-
Ah right that keeps getting me, so from within the container the my.domain.com would resolve to the local system and thus as you can see in the logs, it tries to contact
172.18.0.1
on port 993 which won't work. There you can only contact via port 9993 which is then bound to the mail container. So all you should have to do is to configure nextcloud mail to use that port instead of 993.Port 993 is routed via the external interface to the internal mail container 9993.
@nebulon said in Nextcloud Mail issues:
So all you should have to do is to configure nextcloud mail to use that port instead of 993.
Thanks @nebulon for the help!
Mail app works again after a few changes to the Nextcloud config.
First, I added these parameters to
/app/data/config/config.php
:'allow_local_remote_servers' => true,
(because by default, Nextcloud doesn’t allow local hostnames or IP addresses as remote servers)
'app.mail.verify-tls-peer' => false,
(this just turns off TLS verification for IMAP/SMTP)
Then, in the Nextcloud Mail settings, I set the host to
mail
, IMAP SSL/TLS port to9993
, and SMTP SSL/TLS port to2465
.After that, the app finally connected to my server!
Without these steps, nothing worked. I tried different combinations of IPs, hostnames, and even disabled SSL/TLS and STARTTLS — no luck.
The thing is, I still don’t know why my Mail app worked perfectly with the old settings for months and suddenly stopped now. And yeah, I’m a bit concerned about the security of this workaround.