Skip to content

Commit e933976

Browse files
authored
Merge pull request #580 from barbushin/569/Fix-broken-inline-images
569: Fix broken inline images when header does not contain "Content-Disposition: inline"
2 parents e229515 + 792ff48 commit e933976

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/PhpImap/IncomingMail.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ public function embedImageAttachments(): void
219219
$cid = \str_replace('cid:', '', $match);
220220

221221
foreach ($attachments as $attachment) {
222-
if ($attachment->contentId == $cid && 'inline' == \mb_strtolower((string) $attachment->disposition)) {
222+
/**
223+
* Inline images can contain a "Content-Disposition: inline", but only a "Content-ID" is also enough.
224+
* See https://github.com/barbushin/php-imap/issues/569
225+
*/
226+
if ($attachment->contentId == $cid || 'inline' == \mb_strtolower((string) $attachment->disposition)) {
223227
$contents = $attachment->getContents();
224228
$contentType = (string) $attachment->getFileInfo(FILEINFO_MIME);
225229

src/PhpImap/Mailbox.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ protected function initMailPart(IncomingMail $mail, object $partStructure, $part
16521652
}
16531653
}
16541654

1655-
$isAttachment = isset($params['filename']) || isset($params['name']);
1655+
$isAttachment = isset($params['filename']) || isset($params['name']) || isset($partStructure->id);
16561656

16571657
$dispositionAttachment = (
16581658
isset($partStructure->disposition) &&

0 commit comments

Comments
 (0)