From b1f46d818909eda0b30fd440caa15212cf8b218a Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 19 May 2017 15:56:48 +0200 Subject: [PATCH] Fix mail shows empty mailboxes for some specific mail servers --- api/src/Mail.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/src/Mail.php b/api/src/Mail.php index 7698f83668..a76b7afb60 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -1885,6 +1885,12 @@ class Mail { $sortResult = $this->icServer->search($_folderName, $filter, array( 'sort' => $sortOrder,)); + + // Attempt another search without sorting filter if first try failed with + // no result, as may some servers do not coupe well with sort option + // eventhough they claim to support SORT capability. + if (!isset($sortResult['count'])) $sortResult = $this->icServer->search($_folderName, $filter); + // if there is an Error, we assume that the server is not capable of sorting } catch(\Exception $e)