Hundreds of errors in the error log.
[mail] Error: OCA\Mail\Exception\ServiceException: IMAP errorError connecting to mail server. at <<closure>>
0. /var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php line 91
OCA\Mail\IMAP\MailboxSync->sync(OCA\Mail\Account {}, true)
1. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 80
OCA\Mail\BackgroundJob\SyncJob->run({accountId: 8})
2. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 61
OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
3. /var/www/nextcloud/cron.php line 126
OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})
Caused by Horde_Imap_Client_Exception: Error connecting to mail server.
0. /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php - line 375:
Horde_Imap_Client_Socket->_connect()
1. /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 838:
Horde_Imap_Client_Socket->_login("*** sensiti ... *")
2. /var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php - line 1389:
Horde_Imap_Client_Base->login("*** sensiti ... *")
3. /var/www/nextcloud/apps/mail/lib/IMAP/FolderMapper.php - line 60:
Horde_Imap_Client_Base->listMailboxes("*", 5, { delimiter: ... e})
4. /var/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php - line 85:
OCA\Mail\IMAP\FolderMapper->getFolders(OCA\Mail\Account {}, Horde_Imap_C ... e})
5. /var/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php - line 91:
OCA\Mail\IMAP\MailboxSync->sync(OCA\Mail\Account {}, true)
6. /var/www/nextcloud/lib/public/BackgroundJob/Job.php - line 80:
OCA\Mail\BackgroundJob\SyncJob->run({ accountId: 8})
7. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php - line 61:
OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
8. /var/www/nextcloud/cron.php - line 126:
OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})
Mail app version: 1.4.1
Mailserver or service: ISP IMAP
Operating system: Ubuntu
Web server: Nginx
Database: MariaDB
PHP version: 7.3
Nextcloud Version: 19.0.3
{ accountId: 8}
You can look into oc_mail_accounts to see if the account with id 8 is a stale one, like with an old, outdated password. That would explain why the error is recurring.
How often does this show up?
Every 5 minutes, so at each Cron run i suppose?
After verification, {accountId: 8} is a valid one, not stale or doubled, and used daily by it's user.
Does occ mail:account:sync 8 run without errors?
In MailboxSync.php line 88:
IMAP errorError connecting to mail server.
In Socket.php line 605:
Error connecting to mail server.
But it is the same with other IDs (9, 10, 11...)
Well either that mail server has hiccups and goes down sporadically or those accounts will never work.
So the issue is Mail can't connect to those mail servers. Inspect mail_accounts.inbound_host for those accounts if that gives you any hint or see a pattern with failing accounts. This is not a bug in the app.
Non, inbound_host is OK and those accounts works in the Mail app... :\
those accounts works in the Mail app...
What is the definition of "work"? :wink: Just browsing the cached messages or actually triggering a synchronization of the latest messages?
Do you use auto provisioning or something like that on your system? Did the users have their accounts set up automatically?
No, accounts are manually added by each user.
Emails are received/sent, placed in the Inbox or Sent box, etc.
There is something wrong, for sure, but i just think that error message is not that explicit.
There is something wrong, for sure, but i just think that error message is not that explicit.
Fair enough. What you could do is (at less busy hours) disable the cron shortly, enable debug mode and run the sync via occ for one of those accounts. Then you can inspect the data/horde_imap.log and hopefully find more infos.
Another thing worth a try is https://github.com/nextcloud/mail/blob/master/doc/admin.md#imap-timeout. Maybe your server is running into a timeout when the network is busy.
Tried with 'app.mail.imap.timeout' => 60 same result, will try your 1st approach, thanks 👍
As nobody else is reporting the same and issue seem fixed on my side, closing this.