php-imap
php-imap copied to clipboard
Some inline attachments are not reachable with ->attachments()
Describe the bug Some incoming emails have inline attachments, but I can not get them with ->attachments(); Idk if I am doing something wrong or it is a bug :D :)
Code to Reproduce The troubling code section which produces the reported bug.
try {
$client = $this->ConnectToImapClient($model->email);
$messages = $client->getFolderByPath('INBOX')->messages()->unseen()->get();
} catch (\Throwable $throwable) {
$this->loggingService->warningLog($throwable->getMessage(), $throwable->getFile(), $throwable->getLine());
}
if (!isset($messages[0])) {
return null;
}
foreach ($messages as $message) {
dd($message, $message->attachments());
}
private function ConnectToImapClient(string $mail): ?Client
{
$mailAccessToken = $this->oauth2Service->GetAccessToken($mail);
$clientManager = new ClientManager();
$client = $clientManager->make([
'host' => 'outlook.office365.com',
'port' => 993,
'encryption' => 'ssl', // 'tls',
'validate_cert' => true,
'username' => $mail,
'password' => $mailAccessToken,
'protocol' => 'imap',
'authentication' => 'oauth',
]);
$client->connect();
if ($client->isConnected()) {
return $client;
}
}
Screenshots

Desktop / Server (please complete the following information):
- PHP: 7.4.19
- Version: 2.7.2
- Provider: Outlook