[GH-ISSUE #589] Inline Content IDs (CID) not properly displaying embedded images in HTML emails #377

Closed
opened 2026-03-15 14:08:33 +03:00 by kerem · 5 comments
Owner

Originally created by @webfleetneumann on GitHub (Dec 1, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/589

Description

HTML emails with inline images using Content-ID references (CID) are not displaying correctly in Mailpit's web interface and REST interface.

Environment

  • Mailpit Version: v1.27.10
  • Operating System: Windows 11 Enterprise Version 24H2
  • Browser: Google Chrome Version 141.0.7390.123

Steps to Reproduce

  • Send an HTML email containing embedded images with Content-ID references.
[img src="cid:8547263218c9-fbdb-b284-74ca@834353be=" alt="Inline Image"/]
[
  {
    "content": "[some binary content]",
    "filename": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png",
    "mimeType": "image/png",
    "contentId": "8547263218c9-fbdb-b284-74ca@834353be"
  }
]
  • Open the email in Mailpit web interface as HTML preview.

Actual Behavior

  • Image not displayed inline (broken image icon) and only listed as a normal attachment.
  • In RAW content: Content-Disposition is {{attachment}}
  • Via REST {{GET /api/v1/message/{ID})}} the item appears only in Attachments array with empty ContentID.
Content-Type: image/png; name="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png"
{
  "Attachments": [
    {
      "PartID": "2",
      "FileName": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png",
      "ContentType": "image/png",
      "ContentID": "",
      "Size": 34287
    }
  ]
}

Expected Behavior

The image should display inline within the email body as intended in HTML view.

Content-Type: image/png; name="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png"
Content-ID: [8547263218c9-fbdb-b284-74ca@834353be]
{
  "Inline": [
    {
      "PartID": "1.2",
      "FileName": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png",
      "ContentType": "image/png",
      "ContentID": "8547263218c9-fbdb-b284-74ca@834353be",
      "Size": 34287
    }
  ]
}

Impl-Details

Root cause is located in the enmime parser - see: https://github.com/jhillyerd/enmime/issues/382 and a bugfix PR already created.
Increase the enmime lib version when this PR is merged + released

Originally created by @webfleetneumann on GitHub (Dec 1, 2025). Original GitHub issue: https://github.com/axllent/mailpit/issues/589 ### Description HTML emails with inline images using Content-ID references (CID) are not displaying correctly in Mailpit's web interface and REST interface. ### Environment - Mailpit Version: v1.27.10 - Operating System: Windows 11 Enterprise Version 24H2 - Browser: Google Chrome Version 141.0.7390.123 ### Steps to Reproduce - Send an HTML email containing embedded images with Content-ID references. ``` [img src="cid:8547263218c9-fbdb-b284-74ca@834353be=" alt="Inline Image"/] ``` ``` [ { "content": "[some binary content]", "filename": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png", "mimeType": "image/png", "contentId": "8547263218c9-fbdb-b284-74ca@834353be" } ] ``` - Open the email in Mailpit web interface as HTML preview. ### Actual Behavior * Image not displayed inline (broken image icon) and only listed as a normal attachment. * In RAW content: Content-Disposition is {{attachment}} * Via REST {{GET /api/v1/message/\{ID\})}} the item appears only in Attachments array with empty ContentID. ``` Content-Type: image/png; name="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png" ``` ``` { "Attachments": [ { "PartID": "2", "FileName": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png", "ContentType": "image/png", "ContentID": "", "Size": 34287 } ] } ``` ### Expected Behavior The image should display inline within the email body as intended in HTML view. ``` Content-Type: image/png; name="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png" Content-ID: [8547263218c9-fbdb-b284-74ca@834353be] ``` ``` { "Inline": [ { "PartID": "1.2", "FileName": "inline-cid-a9766747447b-6c1b-5044-28b3@e6204f51--TTZQUnDaeS0Dui9XB.png", "ContentType": "image/png", "ContentID": "8547263218c9-fbdb-b284-74ca@834353be", "Size": 34287 } ] } ``` ### Impl-Details Root cause is located in the enmime parser - see: [https://github.com/jhillyerd/enmime/issues/382](url) and a bugfix PR already created. Increase the enmime lib version when this PR is merged + released
kerem 2026-03-15 14:08:33 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@axllent commented on GitHub (Dec 1, 2025):

I would have expected this to still work in Mailpit (to provide "backwards compatibility" with some older / broken email clients). Could you please attach a full raw email example for me to test? Thanks.

<!-- gh-comment-id:3598377495 --> @axllent commented on GitHub (Dec 1, 2025): I would have expected this to still work in Mailpit (to provide "backwards compatibility" with some older / broken email clients). Could you please attach a full raw email example for me to test? Thanks.
Author
Owner

@homersimpsons commented on GitHub (Dec 8, 2025):

For the record, I have version v1.25.0 through Docker and it works with cid such as (code from "Raw" tab):

<img src=3D"cid:237b8e10ed=
6a1f087ea1b293738c4250@symfony" width=3D"200px" alt=3D"logo" style=3D"width=
: 200px;" />
<img src=3D"cid:e359a77d5bb5975c93726741b56b250c@symfony" width=3D"10=
0px" alt=3D"logo" style=3D"width: 100px;" />
<!-- gh-comment-id:3627228990 --> @homersimpsons commented on GitHub (Dec 8, 2025): For the record, I have version v1.25.0 through Docker and it works with cid such as (code from "Raw" tab): ```html <img src=3D"cid:237b8e10ed= 6a1f087ea1b293738c4250@symfony" width=3D"200px" alt=3D"logo" style=3D"width= : 200px;" /> <img src=3D"cid:e359a77d5bb5975c93726741b56b250c@symfony" width=3D"10= 0px" alt=3D"logo" style=3D"width: 100px;" /> ```
Author
Owner

@axllent commented on GitHub (Dec 9, 2025):

Thanks for the confirmation @homersimpsons - it works perfectly fine for me too. I've asked @webfleetneumann twice now for a working example of a full ram email (which fails) but he hasn't responded to either request 🤷‍♂️ The tests he included in his related PR also work perfectly fine without his patch, so I'm suspecting there is AI involved here. I'll check to the upstream PR to see if it made any sense to the author.

<!-- gh-comment-id:3629978930 --> @axllent commented on GitHub (Dec 9, 2025): Thanks for the confirmation @homersimpsons - it works perfectly fine for me too. I've asked @webfleetneumann twice now for a working example of a full ram email (which fails) but he hasn't responded to either request 🤷‍♂️ The tests he included in [his related PR](#590) also work perfectly fine without his patch, so I'm suspecting there is AI involved here. I'll check to the [upstream PR](https://github.com/jhillyerd/enmime/pull/383) to see if it made any sense to the author.
Author
Owner

@github-actions[bot] commented on GitHub (Dec 17, 2025):

This issue has been marked as stale because it has been open for 7 days with no activity.

<!-- gh-comment-id:3663321671 --> @github-actions[bot] commented on GitHub (Dec 17, 2025): This issue has been marked as stale because it has been open for 7 days with no activity.
Author
Owner

@github-actions[bot] commented on GitHub (Dec 21, 2025):

This issue was closed because there has been no activity since being marked as stale.

<!-- gh-comment-id:3678362278 --> @github-actions[bot] commented on GitHub (Dec 21, 2025): This issue was closed because there has been no activity since being marked as stale.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#377
No description provided.