diff --git a/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php b/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php index 78fc40f65..a39202ace 100644 --- a/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php +++ b/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php @@ -29,11 +29,13 @@ class ImapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges ); $aResult = []; - foreach ($oImapClient->Fetch(['BODY.PEEK[HEADER.FIELDS (FROM)]'], \implode(',', $aUids), true) as $oFetchResponse) { - $oHeaders = new \MailSo\Mime\HeaderCollection($oFetchResponse->GetHeaderFieldsValue()); - $oFrom = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::FROM_, true); - foreach ($oFrom as $oMail) { - $aResult[] = [$oMail->GetEmail(), $oMail->GetDisplayName()]; + if ($aUids) { + foreach ($oImapClient->Fetch(['BODY.PEEK[HEADER.FIELDS (FROM)]'], \implode(',', $aUids), true) as $oFetchResponse) { + $oHeaders = new \MailSo\Mime\HeaderCollection($oFetchResponse->GetHeaderFieldsValue()); + $oFrom = $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::FROM_, true); + foreach ($oFrom as $oMail) { + $aResult[] = [$oMail->GetEmail(), $oMail->GetDisplayName()]; + } } }