Horde_Imap_Client_Exception

Hi I’m facing problems, and I can’t find a solution. first the refresh of mails take sometimes a long time to be done.
install on openmediavault, with swag on docker
Second, I have these logs :
‘’'Horde_Imap_Client_Exception Error when communicating with the mail server.

  1. /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 4560
Horde_Imap_Client_Socket_Connection_Socket->read
()
  1. /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 623
Horde_Imap_Client_Socket->_getLine
()
  1. /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 375
Horde_Imap_Client_Socket->_connect
()
  1. /config/www/nextcloud/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.phpLigne 73
Horde_Imap_Client_Socket->_login
(
  "*** sensitive parameters replaced ***"
)
  1. /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.phpLigne 853
OCA\Mail\IMAP\ImapClientRateLimitingDecorator->_login
(
  "*** sensitive parameters replaced ***"
)
  1. /config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.phpLigne 222
Horde_Imap_Client_Base->login
(
  "*** sensitive parameters replaced ***"
)
  1. /config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.phpLigne 137
OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync
(
  "*** sensitive parameters replaced ***"
)
  1. /config/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.phpLigne 111
OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount
(
  "*** sensitive parameters replaced ***"
)
  1. /app/www/public/lib/public/BackgroundJob/Job.phpLigne 81
OCA\Mail\BackgroundJob\SyncJob->run
()
  1. /app/www/public/lib/public/BackgroundJob/TimedJob.phpLigne 102
OCP\BackgroundJob\Job->start
()
  1. /app/www/public/lib/public/BackgroundJob/TimedJob.phpLigne 92
OCP\BackgroundJob\TimedJob->start
()
  1. /app/www/public/cron.phpLigne 152
OCP\BackgroundJob\TimedJob->execute
()

‘’’

{
 "reqId": "IokJX6PEJXQudgtnFAtE",
 "level": 3,
 "time": "2024-03-27T09:20:39+00:00",
 "remoteAddr": "",
 "user": "--",
 "app": "mail",
 "method": "",
 "url": "--",
 "message": "Cron mail sync failed for account 2",
 "userAgent": "--",
 "version": "28.0.3.2",
 "exception": {
   "Exception": "Horde_Imap_Client_Exception",
   "Message": "Error when communicating with the mail server.",
   "Code": 28,
   "Trace": [
     {
       "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
       "line": 4560,
       "function": "read",
       "class": "Horde_Imap_Client_Socket_Connection_Socket",
       "type": "->"
     },
     {
       "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
       "line": 623,
       "function": "_getLine",
       "class": "Horde_Imap_Client_Socket",
       "type": "->"
     },
     {
       "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
       "line": 375,
       "function": "_connect",
       "class": "Horde_Imap_Client_Socket",
       "type": "->"
     },
     {
       "file": "/config/www/nextcloud/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.php",
       "line": 73,
       "function": "_login",
       "class": "Horde_Imap_Client_Socket",
       "type": "->",
       "args": [
         "*** sensitive parameters replaced ***"
       ]
     },
     {
       "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
       "line": 853,
       "function": "_login",
       "class": "OCA\\Mail\\IMAP\\ImapClientRateLimitingDecorator",
       "type": "->",
       "args": [
         "*** sensitive parameters replaced ***"
       ]
     },
     {
       "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
       "line": 222,
       "function": "login",
       "class": "Horde_Imap_Client_Base",
       "type": "->",
       "args": [
         "*** sensitive parameters replaced ***"
       ]
     },
     {
       "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
       "line": 137,
       "function": "sync",
       "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
       "type": "->",
       "args": [
         "*** sensitive parameters replaced ***"
       ]
     },
     {
       "file": "/config/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php",
       "line": 111,
       "function": "syncAccount",
       "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
       "type": "->",
       "args": [
         "*** sensitive parameters replaced ***"
       ]
     },
     {
       "file": "/app/www/public/lib/public/BackgroundJob/Job.php",
       "line": 81,
       "function": "run",
       "class": "OCA\\Mail\\BackgroundJob\\SyncJob",
       "type": "->"
     },
     {
       "file": "/app/www/public/lib/public/BackgroundJob/TimedJob.php",
       "line": 102,
       "function": "start",
       "class": "OCP\\BackgroundJob\\Job",
       "type": "->"
     },
     {
       "file": "/app/www/public/lib/public/BackgroundJob/TimedJob.php",
       "line": 92,
       "function": "start",
       "class": "OCP\\BackgroundJob\\TimedJob",
       "type": "->"
     },
     {
       "file": "/app/www/public/cron.php",
       "line": 152,
       "function": "execute",
       "class": "OCP\\BackgroundJob\\TimedJob",
       "type": "->"
     }
   ],
   "File": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php",
   "Line": 241,
   "message": "Cron mail sync failed for account {accountId}",
   "exception": {
     "details": null,
     "logged": false,
     "raw_msg": "Error when communicating with the mail server."
   },
   "CustomMessage": "Cron mail sync failed for account 2"
 },
 "id": "6603e4f0c36b8"
}

here what I’ve done in my config.php :
‘’’
‘allow_local_remote_servers’ => true,
‘app.mail.imap.timeout’ => 25,
‘app.mail.smtp.timeout’ => 5,
‘’’

I’ve searched for a solution but can’ty find it… Sorry for my english level.

looks rather complicated… i think it would help if you would try to explain your goal in detail.

awww… and it’s always important to get some more informations out about your installation itself as well as your server environment - the underlaying template isn’t there for just torturing our users but it would hopefully convey some needed informations to the ppl who want to help.

hi thx for reply.
i’m not sure i understand… the environement is : “install on openmediavault, with swag on docker” swag and nextcloud are install on docker. What can I tell more ?
I don’t understand the “underlaying template” and the “ppl”…
I gave all the logs, and I think it’is precise.
My goal is to not have errors, and have nextcloud mail ruuning without lags.
What do you want to know more ?
Sorry for my english level

OK sorry I was’t precise enough.

I wanted to know what you want to achieve here? What’s your point?
Plus: which versions do you run? Nextcloud? PhP? Swag? OMV?
BTW: What is “swag” exactly?

I don’t think it’s a nextcloud problem but more a problem of your setup.

ok thanks. I understand now, my bad.
Debian 12
Openmediavault 7.0.4
Nextcloud 28.0.4
php 8.1 or 8.2 (not sure how i verify this)
Swag is a reverse proxy, I use nginx too

I think so but don’t understand what it is.

I have this log appears yesterday :

RelatedResourceProviderNotFound Exception thrown: OCA\RelatedResources\Exceptions\RelatedResourceProviderNotFound
{
  "reqId": "IhsWTUxjizTINNNG3mVl",
  "level": 3,
  "time": "2024-04-01T17:06:25+00:00",
  "remoteAddr": "192.168.x.xx",
  "user": "Marjorie",
  "app": "related_resources",
  "method": "GET",
  "url": "/ocs/v2.php/apps/related_resources/related/account?itemId=xxxxx&resourceType=deck&limit=5&format=json",
  "message": "Exception thrown: OCA\\RelatedResources\\Exceptions\\RelatedResourceProviderNotFound",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0",
  "version": "28.0.3.2",
  "exception": {
    "Exception": "OCA\\RelatedResources\\Exceptions\\RelatedResourceProviderNotFound",
    "Message": "",
    "Code": 0,
    "Trace": [
      {
        "file": "/config/www/nextcloud/apps/related_resources/lib/Service/RelatedService.php",
        "line": 173,
        "function": "getRelatedResourceProvider",
        "class": "OCA\\RelatedResources\\Service\\RelatedService",
        "type": "->"
      },
      {
        "file": "/config/www/nextcloud/apps/related_resources/lib/Service/RelatedService.php",
        "line": 127,
        "function": "retrieveRelatedToItem",
        "class": "OCA\\RelatedResources\\Service\\RelatedService",
        "type": "->"
      },
      {
        "file": "/config/www/nextcloud/apps/related_resources/lib/Controller/ApiController.php",
        "line": 107,
        "function": "getRelatedToItem",
        "class": "OCA\\RelatedResources\\Service\\RelatedService",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "getRelatedResources",
        "class": "OCA\\RelatedResources\\Controller\\ApiController",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/app/www/public/ocs/v1.php",
        "line": 65,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/app/www/public/ocs/v2.php",
        "line": 23,
        "args": [
          "/app/www/public/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/config/www/nextcloud/apps/related_resources/lib/Service/RelatedService.php",
    "Line": 605,
    "message": "",
    "exception": [],
    "CustomMessage": "Exception thrown: OCA\\RelatedResources\\Exceptions\\RelatedResourceProviderNotFound"
  },
  "id": "660be1f8d5530"
}

maybe it helps

try disabling it first and then see if the error has gone. plus: if your mail got faster

what do you want me to disable ?

try disabling app related resources from your admin menu

Ok I do this and tell you. Thx

I have this error appears :

[mail] Erreur: Could not fetch stats of mailbox 77. IMAP error: Error when communicating with the mail server.
	POST /apps/mail/api/mailboxes/77/sync
	de 192.168.x.xx par xxxx à 5 avr. 2024, 10:59:53
    /config/www/nextcloud/apps/mail/lib/Controller/MailboxesController.phpLigne 155

    OCA\Mail\Service\Sync\SyncService->syncMailbox(
      "*** sensitive parameters replaced ***"
    )

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.phpLigne 230

    OCA\Mail\Controller\MailboxesController->sync(
      "*** sensitive parameters replaced ***"
    )

    /app/www/public/lib/private/AppFramework/Http/Dispatcher.phpLigne 137

    OC\AppFramework\Http\Dispatcher->executeController()

    /app/www/public/lib/private/AppFramework/App.phpLigne 184

    OC\AppFramework\Http\Dispatcher->dispatch()

    /app/www/public/lib/private/Route/Router.phpLigne 315

    OC\AppFramework\App::main()

    /app/www/public/lib/base.phpLigne 1069

    OC\Route\Router->match()

    /app/www/public/index.phpLigne 39

    OC::handleRequest()

Causé par Horde_Imap_Client_Exception Error when communicating with the mail server.
{
  "reqId": "qxfq2iTfGEoVDpyHf0wh",
  "level": 3,
  "time": "2024-04-05T08:59:53+00:00",
  "remoteAddr": "192.168.x.xx",
  "user": "xxxxxx",
  "app": "mail",
  "method": "POST",
  "url": "/apps/mail/api/mailboxes/77/sync",
  "message": "Could not fetch stats of mailbox 77. IMAP error: Error when communicating with the mail server.",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0",
  "version": "28.0.3.2",
  "exception": {
    "Exception": "OCA\\Mail\\Exception\\ServiceException",
    "Message": "Could not fetch stats of mailbox 77. IMAP error: Error when communicating with the mail server.",
    "Code": 28,
    "Trace": [
      {
        "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
        "line": 132,
        "function": "syncStats",
        "class": "OCA\\Mail\\IMAP\\MailboxSync",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/config/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
        "line": 155,
        "function": "syncMailbox",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "sync",
        "class": "OCA\\Mail\\Controller\\MailboxesController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/app/www/public/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/app/www/public/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/config/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php",
    "Line": 169,
    "Previous": {
      "Exception": "Horde_Imap_Client_Exception",
      "Message": "Error when communicating with the mail server.",
      "Code": 28,
      "Trace": [
        {
          "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
          "line": 4560,
          "function": "read",
          "class": "Horde_Imap_Client_Socket_Connection_Socket",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
          "line": 623,
          "function": "_getLine",
          "class": "Horde_Imap_Client_Socket",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
          "line": 375,
          "function": "_connect",
          "class": "Horde_Imap_Client_Socket",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.php",
          "line": 73,
          "function": "_login",
          "class": "Horde_Imap_Client_Socket",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
          "line": 853,
          "function": "_login",
          "class": "OCA\\Mail\\IMAP\\ImapClientRateLimitingDecorator",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
          "line": 1613,
          "function": "login",
          "class": "Horde_Imap_Client_Base",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/config/www/nextcloud/apps/mail/lib/IMAP/FolderMapper.php",
          "line": 141,
          "function": "status",
          "class": "Horde_Imap_Client_Base",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php",
          "line": 166,
          "function": "getFoldersStatusAsObject",
          "class": "OCA\\Mail\\IMAP\\FolderMapper",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
          "line": 132,
          "function": "syncStats",
          "class": "OCA\\Mail\\IMAP\\MailboxSync",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/config/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
          "line": 155,
          "function": "syncMailbox",
          "class": "OCA\\Mail\\Service\\Sync\\SyncService",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 230,
          "function": "sync",
          "class": "OCA\\Mail\\Controller\\MailboxesController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 137,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/app/www/public/lib/base.php",
          "line": 1069,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/app/www/public/index.php",
          "line": 39,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php",
      "Line": 241
    },
    "message": "Could not fetch stats of mailbox 77. IMAP error: Error when communicating with the mail server.",
    "exception": [],
    "CustomMessage": "Could not fetch stats of mailbox 77. IMAP error: Error when communicating with the mail server."
  },
  "id": "660fbd8eb09b4"
}

And this one :

 TypeError OCA\Mail\Controller\PreferencesController::__construct(): Argument #3 ($UserId) must be of type string, null given

    OCA\Mail\Controller\PreferencesController->__construct()
/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.phpLigne 83

ReflectionClass->newInstanceArgs()

/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.phpLigne 128

OC\AppFramework\Utility\SimpleContainer->buildClass()

/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.phpLigne 146

OC\AppFramework\Utility\SimpleContainer->resolve()

/app/www/public/lib/private/AppFramework/DependencyInjection/DIContainer.phpLigne 468

OC\AppFramework\Utility\SimpleContainer->query()

/app/www/public/lib/private/AppFramework/DependencyInjection/DIContainer.phpLigne 440

OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()

/app/www/public/lib/private/AppFramework/App.phpLigne 163

OC\AppFramework\DependencyInjection\DIContainer->query()

/app/www/public/lib/private/Route/Router.phpLigne 315

OC\AppFramework\App::main()

/app/www/public/lib/base.phpLigne 1069

OC\Route\Router->match()

/app/www/public/index.phpLigne 39

OC::handleRequest()
{
  "reqId": "xxxxxxxxxxxxxx",
  "level": 3,
  "time": "2024-04-05T09:08:29+00:00",
  "remoteAddr": "192.168.x.xx",
  "user": "--",
  "app": "index",
  "method": "PUT",
  "url": "/apps/mail/api/preferences/start-mailbox-id",
  "message": "OCA\\Mail\\Controller\\PreferencesController::__construct(): Argument #3 ($UserId) must be of type string, null given",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0",
  "version": "28.0.3.2",
  "exception": {
    "Exception": "TypeError",
    "Message": "OCA\\Mail\\Controller\\PreferencesController::__construct(): Argument #3 ($UserId) must be of type string, null given",
    "Code": 0,
    "Trace": [
      {
        "function": "__construct",
        "class": "OCA\\Mail\\Controller\\PreferencesController",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 83,
        "function": "newInstanceArgs",
        "class": "ReflectionClass",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 128,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 146,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 468,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 440,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/AppFramework/App.php",
        "line": 163,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/app/www/public/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/app/www/public/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/config/www/nextcloud/apps/mail/lib/Controller/PreferencesController.php",
    "Line": 45,
    "message": "OCA\\Mail\\Controller\\PreferencesController::__construct(): Argument #3 ($UserId) must be of type string, null given",
    "exception": [],
    "CustomMessage": "OCA\\Mail\\Controller\\PreferencesController::__construct(): Argument #3 ($UserId) must be of type string, null given"
  },
  "id": "660fbfa4cb219"
}

The app still lag, some folder take more than ten seconds to open.

and still this error

 Horde_Imap_Client_Exception Error when communicating with the mail server.
Cron mail sync failed for account 4 

Any ideas ?

I keep having those erros :

 Horde_Imap_Client_Exception Error when communicating with the mail server.
Cron mail sync failed for account 4 
    /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 4560

    Horde_Imap_Client_Socket_Connection_Socket->read()

    /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 623

    Horde_Imap_Client_Socket->_getLine()

    /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.phpLigne 375

    Horde_Imap_Client_Socket->_connect()

    /config/www/nextcloud/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.phpLigne 73

    Horde_Imap_Client_Socket->_login(
      "*** sensitive parameters replaced ***"
    )

    /config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.phpLigne 853

    OCA\Mail\IMAP\ImapClientRateLimitingDecorator->_login(
      "*** sensitive parameters replaced ***"
    )

    /config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.phpLigne 222

    Horde_Imap_Client_Base->login(
      "*** sensitive parameters replaced ***"
    )

    /config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.phpLigne 137

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(
      "*** sensitive parameters replaced ***"
    )

    /config/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.phpLigne 111

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(
      "*** sensitive parameters replaced ***"
    )

    /app/www/public/lib/public/BackgroundJob/Job.phpLigne 81

    OCA\Mail\BackgroundJob\SyncJob->run()

    /app/www/public/lib/public/BackgroundJob/TimedJob.phpLigne 102

    OCP\BackgroundJob\Job->start()

    /app/www/public/lib/public/BackgroundJob/TimedJob.phpLigne 92

    OCP\BackgroundJob\TimedJob->start()

    /app/www/public/cron.phpLigne 152

    OCP\BackgroundJob\TimedJob->execute()
{
  "reqId": "l1bO81SE5sVrdEzOkXeY",
  "level": 3,
  "time": "2024-04-10T15:27:19+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "mail",
  "method": "",
  "url": "--",
  "message": "Cron mail sync failed for account 4",
  "userAgent": "--",
  "version": "28.0.3.2",
  "exception": {
    "Exception": "Horde_Imap_Client_Exception",
    "Message": "Error when communicating with the mail server.",
    "Code": 28,
    "Trace": [
      {
        "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 4560,
        "function": "read",
        "class": "Horde_Imap_Client_Socket_Connection_Socket",
        "type": "->"
      },
      {
        "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 623,
        "function": "_getLine",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 375,
        "function": "_connect",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/config/www/nextcloud/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.php",
        "line": 73,
        "function": "_login",
        "class": "Horde_Imap_Client_Socket",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
        "line": 853,
        "function": "_login",
        "class": "OCA\\Mail\\IMAP\\ImapClientRateLimitingDecorator",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 222,
        "function": "login",
        "class": "Horde_Imap_Client_Base",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/config/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 137,
        "function": "sync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/config/www/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php",
        "line": 111,
        "function": "syncAccount",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/app/www/public/lib/public/BackgroundJob/Job.php",
        "line": 81,
        "function": "run",
        "class": "OCA\\Mail\\BackgroundJob\\SyncJob",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/public/BackgroundJob/TimedJob.php",
        "line": 102,
        "function": "start",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/public/BackgroundJob/TimedJob.php",
        "line": 92,
        "function": "start",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      },
      {
        "file": "/app/www/public/cron.php",
        "line": 152,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/config/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php",
    "Line": 241,
    "message": "Cron mail sync failed for account {accountId}",
    "exception": {
      "details": null,
      "logged": false,
      "raw_msg": "Error when communicating with the mail server."
    },
    "CustomMessage": "Cron mail sync failed for account 4"
  },
  "id": "6616b55558e74"

If someone has an idea, it will be great, cause I can’t find anything on the net to resolve this…

what kind of mailserver do you have? do you run it yourself, perhaps?

the mail server is mailo.com, I don’t run it myself

would you mind giving me a screenshot of your setup of your “emailserver” in your admin-account? https://put.yoururl.here/settings/admin

from nextcloud ?

of course from your nextcloud

If it can help:
I have the same errors ( Cron mail sync failed for account **, Horde_Imap_Client_Exception, etc.) with mailo.com provider email.
The mail address is used like user mail (not like admin mail). It works, but there is these errors in Nextcloud log file.
No problems with other providers (orange.fr, laposte.net, ovh.com)
Found in the horde_imap log :

>> Thu, 06 Jun 2024 11:50:11 +0000
>> Connection to: imap://mail.mailo.com:993/
>> Server connection took 0.0938 seconds.
S: * OK [CAPABILITY IMAP4rev1 ID LITERAL+ AUTH=LOGIN AUTH=PLAIN STARTTLS] IMAP4rev1 MAILO Ready
C: 1 [INITIAL CLIENT RESPONSE (username: **********@mailo.fr)]
S: +
C: c3RlcGhhbmUucm91cXVhcnRAbWFpbG8uZnIAc3RlcGhhbmUucm91cXVhcnRAbWFpbG8uZnIAU3l5bkhnVjd5Zkx5
>> Slow Command: 5.003 seconds
>> ERROR: read timeout error.
S: 1 OK [CAPABILITY IMAP4rev1 ID LITERAL+ ENABLE IDLE QUOTA NAMESPACE SORT UIDPLUS UNSELECT UTF8=ACCEPT] Welcome **********@mailo.fr
>> Command 1 took 5.0964 seconds.
C: 2 LOGIN **********@mailo.fr [PASSWORD]
S: 2 BAD Already authenticated
>> Command 2 took 3.0082 seconds.

Tried this test :

openssl s_time -connect imap.domain.tld:993

mailo.com have the best result than other providers.

My config :
Nextcloud 28.0.6 (AIO 8.3.0)
Mail 3.7.1