diff --git a/lib/IMAP/FolderMapper.php b/lib/IMAP/FolderMapper.php index b40d5abebad3b26af10f39a247e56e60b1c03046..f12ea3af815faba68a86d6cfde228bd22b326e88 100644 --- a/lib/IMAP/FolderMapper.php +++ b/lib/IMAP/FolderMapper.php @@ -62,12 +62,24 @@ class FolderMapper { 'special_use' => true, ]); - return array_filter(array_map(function (array $mailbox) use ($account) { + return array_filter(array_map(function (array $mailbox) use ($account, $client) { if (in_array($mailbox['mailbox']->utf8, self::DOVECOT_SIEVE_FOLDERS, true)) { // This is a special folder that must not be shown return null; } + try { + $client->status($mailbox["mailbox"]); + } catch (Horde_Imap_Client_Exception $e) { + // ignore folders which cause errors on access + // (i.e. server-side system I/O errors) + if (in_array($e->getCode(), [ + Horde_Imap_Client_Exception::UNSPECIFIED, + ], true)) { + return null; + } + } + return new Folder( $account->getId(), $mailbox['mailbox'],