-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[12.x] Fix embedded image Content-ID inconsistency in cloned emails #57726
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
[12.x] Fix embedded image Content-ID inconsistency in cloned emails #57726
Conversation
c1a5c50 to
d30da28
Compare
d30da28 to
2965a3d
Compare
|
I feel like we're changing a lot of code and logic just to fix what I would imagine is a much simpler bug? 👀 What is the minimum possible change to fix the issue? |
|
While fixing the misuse of the DataPart API, I found that the tests also needed adjustments. I thought it would be best to fix everything properly. |
|
Hi Taylor, Thank you so much for taking the time to test this - I really appreciate you looking into it personally despite your busy schedule. I've now created a standalone reproduction repository: Why your SMTP test didn't reproduce the bug: SMTP fails at connection time (before rendering), so the Mail object never calls The reproduction repo uses invalid Mailgun credentials (not SMTP) as primary to trigger the render before failover. |
|
Alright - was able to recreate this finally and confirm your fix does indeed resolve the issue. Thanks! |
|
Hi, it seems that this PR might break inline image embedding in emails. This Blade template code used to work before: The src is changed to " |

Problem
When using failover mailer configurations (e.g., Mailgun → AWS SES), embedded
images in emails fail to display after the email object is cloned for retry.
The issue occurs because the Content-ID referenced in HTML (
<img src="cid:...">)and the Content-ID in the MIME attachment become inconsistent after cloning.
Root Cause
Incorrect usage of the
DataPartconstructor inembed()andembedData()methods. The second parameter ofDataPartisfilename, not Content-ID.DataPartgenerates its own Content-ID automatically.Reproduction
I've isolated a unit test to simulate the failover clone scenario. To reproduce the issue, please check out commit 23b3783.
Apology and Context
I apologize for not including a reproduction test in my previous PR #57606. This PR adds a failing test case and the corresponding fix.
Thank you for the patience and thorough review.