I’m getting the same issue.
The Basics
Summary of the issue you are facing:
After initial setup of icloud on the nextcloud email client new messages will not download. I can see that there are emails unread but cannot view them. Other email accounts (GMX, Gmail) appear uneffected
Steps to replicate it (hint: details matter!):
Setup icloud email (I’m using app passwords) with recommended settings. Wait until new messages start coming in and synchronization breaks, roughly 24 hours in my case.
Log entries
These errors show on repeat:
[mail] Error: Sync failed for 1:INBOX: IMAP error reported by server.
POST /apps/mail/api/mailboxes/11/sync
from 165.1.251.174 by aaron at Feb 27, 2025, 10:07:27 AM
[PHP] Error: iconv(): Detected an illegal character in input string at /var/www/nextcloud/apps/mail/lib/IMAP/Charset/Converter.php#43
from ? by ? at Feb 27, 2025, 10:04:26 AM
[PHP] Error: fread(): SSL: Connection reset by peer at /var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php#190
from ? by ? at Feb 27, 2025, 10:02:56 AM
[mail] Error: Cron mail sync failed for account 1
from ? by ? at Feb 27, 2025, 9:30:11 AM
one of the mail sync entries:
{"reqId":"VduZ6B44SjjcFvKGGFhh","level":3,"time":"2025-02-27T09:30:11-08:00","remoteAddr":"","user":false,"app":"mail","method":"","url":"--","message":"Cron mail sync failed for account 1","userAgent":"--","version":"31.0.0.18","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"Sync failed for 1:INBOX: IMAP error reported by server.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":168,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","Line":282,"Previous":{"Exception":"Horde_Imap_Client_Exception_ServerResponse","Message":"IMAP error reported by server.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4319,"function":"_getLine","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4243,"function":"_sendCmdChunk","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":2478,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2282,"function":"_search","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":3542,"function":"search","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Sync.php","line":229,"function":"resolveIds","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":3643,"function":"__construct","class":"Horde_Imap_Client_Data_Sync","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php","line":99,"function":"sync","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php","line":69,"function":"doCombinedSync","class":"OCA\\Mail\\IMAP\\Sync\\Synchronizer","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":401,"function":"sync","class":"OCA\\Mail\\IMAP\\Sync\\Synchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":263,"function":"runPartialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":168,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":4620},"message":"Cron mail sync failed for account {accountId}","exception":[],"CustomMessage":"Cron mail sync failed for account 1"},"id":"67c0ab628a9d1"}
and the mail sync cron entry
{"reqId":"hnGTEtI5ZEHodObqR9M5","level":3,"time":"2025-02-27T08:25:12-08:00","remoteAddr":"","user":false,"app":"mail","method":"","url":"--","message":"Cron mail sync failed for account 1","userAgent":"--","version":"31.0.0.18","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"Sync failed for 1:INBOX: IMAP error reported by server.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":168,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","Line":282,"Previous":{"Exception":"Horde_Imap_Client_Exception_ServerResponse","Message":"IMAP error reported by server.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4319,"function":"_getLine","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4243,"function":"_sendCmdChunk","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":2478,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2282,"function":"_search","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":3542,"function":"search","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Sync.php","line":229,"function":"resolveIds","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":3643,"function":"__construct","class":"Horde_Imap_Client_Data_Sync","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php","line":99,"function":"sync","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php","line":69,"function":"doCombinedSync","class":"OCA\\Mail\\IMAP\\Sync\\Synchronizer","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":401,"function":"sync","class":"OCA\\Mail\\IMAP\\Sync\\Synchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":263,"function":"runPartialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":168,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":4620},"message":"Cron mail sync failed for account {accountId}","exception":[],"CustomMessage":"Cron mail sync failed for account 1"},"id":"67c0ab628abc9"}
Configuration
Nextcloud
The output of occ config:list system
or similar is best, but, if not possible, the contents of your config.php
file from /path/to/nextcloud
is fine (make sure to remove any identifiable information!):
I genuinely don’t know where or how to find this.
Apps
The output of occ app:list
(if possible).
occ command doesn’t work on my install, but I’ve installed only office and mail apps.