Skip to content
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

Support CID embeds #62

Closed
ToshY opened this issue May 27, 2023 · 4 comments
Closed

Support CID embeds #62

ToshY opened this issue May 27, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@ToshY
Copy link

ToshY commented May 27, 2023

Problem

For Symfony projects I've switched from Mailtrap to Mailcrab, and I've just noticed that images embedded with CID are not being displayed in Mailcrab's formatted view.

Raw (truncated email example)

MIME-Version: 1.0
Date: Sat, 27 May 2023 14:45:54 +0200
Content-Type: multipart/related; boundary=VALLHhYX

--VALLHhYX
Content-Type: multipart/alternative; boundary=1mS-w7PU

--1mS-w7PU
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

--1mS-w7PU
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<img src=3D"cid:03487338a9ba70e29f37dd06781f9a95@symfony" alt=3D"">
--1mS-w7PU--

--VALLHhYX
Content-ID: <03487338a9ba70e29f37dd06781f9a95@symfony>
Content-Type: image/png; name="03487338a9ba70e29f37dd06781f9a95@symfony"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 name="03487338a9ba70e29f37dd06781f9a95@symfony";
 filename="@images/favicon.png"

<base64-string-here>
--VALLHhYX--

As you can see in the raw example above, the image src with cid 03487338a9ba70e29f37dd06781f9a95@symfony is available, which contains a base64 encoded string of the image file. But the image itself is available in the email as an attachment instead of being embedded.

image

So it just shows the broken image icon in the formatted view.

image

Proposal

Support for CID embeds.

@stappersg
Copy link
Contributor

stappersg commented May 27, 2023 via email

@ToshY
Copy link
Author

ToshY commented May 28, 2023

@stappersg I'm somewhat confused on what more you would want to see exactly. The raw example response is what I got from the Raw tab in Mailcrab and I removed unncessary html bloat (while keeping content type headers) to show that both the image tag <img src=3D"cid:03487338a9ba70e29f37dd06781f9a95@symfony" alt=3D""> and Content-ID: <03487338a9ba70e29f37dd06781f9a95@symfony> are in there, but Mailcrab evaluates this as an attachment instead of displaying the embedded image in the Formatted view.

I'm not sure if the issue statement is unclear or the definiton of CID embeds? Here's an SO post explaining how they work, showing a similiar response as the example I've provided.

If you insist on having a reproduction case, I can make one in Symfony 6.x (PHP 8.1) even though that has nothing to do with the issue, as the same email gets handled correctly by other mail clients (Mailtrap/Gmail/etc.).


As this library is inspired by Mailhog, you can find the same issue there as well: mailhog/MailHog#27

@marlonbaeten marlonbaeten self-assigned this Jun 6, 2023
@marlonbaeten marlonbaeten added the enhancement New feature or request label Jun 6, 2023
@marlonbaeten
Copy link
Member

Thanks for reporting this @ToshY. This should be fixed - I'll try to implement it soon.

@marlonbaeten
Copy link
Member

This is fixed in v0.19.0 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants