diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 4bd00ba4a..c406920a5 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -527,6 +527,16 @@ class ImapClient extends \MailSo\Net\NetClient return $this->specificFolderList(false, $sParentFolderName, $sListPattern, true); } + /** + * @throws \MailSo\Net\Exceptions\Exception + * @throws \MailSo\Imap\Exceptions\Exception + */ + public function FolderHierarchyDelimiter(string $sFolderName = '') : ?string + { + $oResponse = $this->SendRequestGetResponse('LIST', ['""', $this->EscapeString($sParentFolderName)]); + return ('LIST' === $oResponse[0]->ResponseList[1]) ? $oResponse[0]->ResponseList[3] : null; + } + /** * @throws \MailSo\Base\Exceptions\InvalidArgumentException * @throws \MailSo\Net\Exceptions\Exception diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index f7e249082..49723296d 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -2056,8 +2056,8 @@ class MailClient if (!\strlen($sDelimiter) || \strlen($sFolderParentFullNameRaw)) { - $aFolders = $this->oImapClient->FolderList('', \strlen($sFolderParentFullNameRaw) ? $sFolderParentFullNameRaw : 'INBOX'); - if (!$aFolders) + $sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sFolderParentFullNameRaw); + if (null === $sDelimiter) { // TODO: Translate throw new Exceptions\RuntimeException( @@ -2066,7 +2066,6 @@ class MailClient : 'Cannot get folder delimiter.'); } - $sDelimiter = $aFolders[0]->Delimiter(); if (\strlen($sDelimiter) && \strlen($sFolderParentFullNameRaw)) { $sFolderParentFullNameRaw .= $sDelimiter; @@ -2114,6 +2113,7 @@ class MailClient /** * @throws \MailSo\Base\Exceptions\InvalidArgumentException + * @throws \MailSo\Base\Exceptions\RuntimeException */ protected function folderModify(string $sPrevFolderFullNameRaw, string $sNextFolderNameInUtf, bool $bRename, bool $bSubscribeOnModify) : self {