-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedded images missing #694
Labels
needs investigation
This will be tested / debugged or checked out.
Comments
oioix
added
the
needs investigation
This will be tested / debugged or checked out.
label
Dec 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP IMAP version: 5.0.1
PHP Version: 8.1
Type of execution: CLI or Web Server
Found three bugs with attached images that are embedded. Here is the description and a fix proposal.
Bug Nr. 1)
No matter if
$mailbox->setAttachmentsIgnore()
is set to true or false. In both cases the images are broken.Created email:
Output of received email with php-imap:
The reason is that the nice function
embedImageAttachments()
in IncomingMail.php (Line 208) which had been written to autmatically show the embedded images is never used.I found a fix for that. But then I found ...
Bug Nr. 2
If this function
embedImageAttachments()
is used, images will appear but they get again broken as soon$mailbox->setAttachmentsIgnore()
ist set to true.I could fix it, but then I found ...
Bug Nr. 3
Instead of displaying three different images the first image is display three times. The sources are not correctly assigned to the img tags.
I found the reason for this.
Surprisingly
$attachments = $this->getAttachments();
in IncomingMail.php (around Line 220) returns always only one (the very first) attachment. This is strange, since it should be an array with all attchments in it. I could not find out why, but I'm absolutely sure and proofed it well, it contains only one key(!). So output will surely fail with multiple attachments.But also the rest of the code was not right. So I had to change a bit more here.
Fixed result:
I'd herewith like to share the solution:
CHANGE A)
In IncomingMail.php completely exchange the function
embedImageAttachments()
(very end in php) with this code:CHANGE B)
To init the function and to submit the ignore setting and also the correct attachments array.
In Mailbox.php in the function
getMail()
around the Line Nr.1331/1332:Change end of function from
to:
The text was updated successfully, but these errors were encountered: