Skip to content

Commit 792ff48

Browse files
author
Sebastian Krätzig
committed
569: Fix broken inline images when header does not contain "Content-Disposition: inline"
1 parent 36aa169 commit 792ff48

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/PhpImap/IncomingMail.php

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ protected function initMailPart(IncomingMail $mail, object $partStructure, $part
16361636
}
16371637
}
16381638

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

16411641
$dispositionAttachment = (
16421642
isset($partStructure->disposition) &&

0 commit comments

Comments
 (0)