Cron sync mail errors

Good morning, I have searched about this problem but I can’t find any solution. The mail app performs a synchronization of the imap folders but when users change their passwords this fails.

There are multiple errors on the mail server side and in nextcloud itself
EJ: Horde_Imap_Client_Exception: Authentication failed.

Is there a solution to prevent synchronization of user mailboxes?

Our users must change the password from time to time due to security policy and when this happens the synchronization of the mailboxes fails. I can only think of an option that disables the synchronization option from the cron task.

Did you ever find a solution to his, my maillog is very difficult to parse because of all of these messages. I have not been able to determine why nextcloud.log is indicating the following, despite mail sync seeming to work. Using an LDAP backend.

"message":"Cron mail sync failed for account 30","userAgent":"
--","version":"24.0.8.2","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"IMAP error synchronizing account 30: Remote server is temporarily unavailable.

While the nextcloud logs aren’t as much of a concern, maillog being spammed is more problematic. I know the interval can be changed somewhat, but doesn’t solve the underlying issue.

Edit: Looks like its related to Too long email address breaks sync · Issue #3608 · nextcloud/mail · GitHub in my case.

I’ve got the same error.

I assume, this happens during the cronjob, when the Mail-App tries to sync the mailbox of a user.
Right?

I think the error occurs because there is no valid configuration for the user mailbox and there will be no configuration. The user has an email-address but no password configured, no IMAP-server and no SMTP-Server.

So, I’d like to ask if there is any possibility to exclude these users from email syncing?

Best regards

MF

I have myself lot (~1/hr) of the following error since a few days (and maybe since a Nextcloud update to 28):

Exception HMAC does not match.
Cron mail sync failed for account 2 

I don’t even understand what “account 2” means here…
It all started on Feb 25 with this message after a restart:

 Exception HMAC does not match.
Error while running background job (class: OCA\Mail\BackgroundJob\QuotaJob, arguments: Array ( [accountId] => 2 ) ) 

I don’t know if it is linked but I have sometimes this error too:

Error Failed opening required '/var/www/html/custom_apps/mail/vendor/autoload.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')
1 Like

Same here. Restarted server, now I’m getting this error.

Horde_Imap_Client_Exception
Error connecting to mail server.
Cron mail sync failed for account

Anybody found a way to solve this? It’s very annoying since it renders the mail app unusable.

Update: After closer inspection the Talk app is now bricked as well. Participants cannot join any audio video calls and I am getting a turn server error which I’d never seen before during multiple calls.

Sorry about the frustrated mispost. The turn server error had nothing to do with the mail app. However, I’ve reinstalled Nextcloud on a different server and the mail app has the same Hoarde Exception Thrown Out. Seems like the latest version of mail introduced an issue present on all mail installs.

Same issue here. Example error log:

{"reqId":"9u4T6xN31IAIGWECaJMh","level":3,"time":"16 July 2024 08:55:04","remoteAddr":"","user":"--","app":"mail","method":"","url":"--","message":"Cron mail sync failed for account 1","userAgent":"--","version":"29.0.3.4","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"Sync failed for 1:INBOX: Call to undefined function ini_restore()","Code":0,"Trace":[{"file":"/home/user/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":137,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":110,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/home/user/nextcloud/cron.php","line":177,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/home/user/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","Line":280,"Previous":{"Exception":"Error","Message":"Call to undefined function ini_restore()","Code":0,"Trace":[{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-util/lib/Horde/String.php","line":99,"function":"_convertCharset","class":"Horde_String","type":"::"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime.php","line":254,"function":"convertCharset","class":"Horde_String","type":"::"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Element/Single.php","line":62,"function":"decode","class":"Horde_Mime","type":"::"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Element.php","line":79,"function":"_setValue","class":"Horde_Mime_Headers_Element_Single","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Element.php","line":56,"function":"setValue","class":"Horde_Mime_Headers_Element","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers/Subject.php","line":31,"function":"__construct","class":"Horde_Mime_Headers_Element","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-mime/lib/Horde/Mime/Headers.php","line":201,"function":"__construct","class":"Horde_Mime_Headers_Subject","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Envelope.php","line":160,"function":"addHeader","class":"Horde_Mime_Headers","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":3519,"function":"__set","class":"Horde_Imap_Client_Data_Envelope","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":3169,"function":"_parseEnvelope","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4796,"function":"_parseFetch","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4593,"function":"_serverResponse","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/home/user/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":"/home/user/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":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":2839,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2737,"function":"_fetch","class":"Horde_Imap_Client_Socket","type":"->"},{"file":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2493,"function":"_fetchWrapper","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/home/user/nextcloud/apps/mail/lib/IMAP/MessageMapper.php","line":284,"function":"fetch","class":"Horde_Imap_Client_Base","type":"->"},{"function":"OCA\\Mail\\IMAP\\{closure}","class":"OCA\\Mail\\IMAP\\MessageMapper","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/apps/mail/lib/functions.php","line":35,"function":"array_map"},{"file":"/home/user/nextcloud/apps/mail/lib/IMAP/MessageMapper.php","line":283,"function":"OCA\\Mail\\array_flat_map"},{"file":"/home/user/nextcloud/apps/mail/lib/IMAP/Sync/Synchronizer.php","line":100,"function":"findByIds","class":"OCA\\Mail\\IMAP\\MessageMapper","type":"->"},{"file":"/home/user/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":398,"function":"sync","class":"OCA\\Mail\\IMAP\\Sync\\Synchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":261,"function":"runPartialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/home/user/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":137,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":110,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/home/user/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/home/user/nextcloud/cron.php","line":177,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/home/user/nextcloud/apps/mail/vendor/bytestream/horde-util/lib/Horde/String.php","Line":161},"message":"Cron mail sync failed for account {accountId}","exception":{},"CustomMessage":"Cron mail sync failed for account 1"}}