You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might seem correct to set a CID, but this is only works for attachments if they don't have a content ID. "ad-hoc" attachments using Twig broke here if that part (for whatever reason) has a content ID which will always differ from the filepath.
The problem is that the resulting markup is still referencing the "old" CID:
<img src=3D"cid:@assets/img/email-bg.png" ….
I guess this might have been the reason why the filename was used for ContentID instead of actually using DataPart::getContentId().
How to reproduce
Attach an image part with a CID to an email using email.image in Twig. Send templated email with Postmark API.
Possible Solution
A valid fix (apart from reverting the PR) might be updating WrappedTemplatedEmail::image to actually use the CID of the image part it attaches. I tested this with local Maildev and a real Postmark API transport, but there might be problems I'm not thinking about. This would also "improve" image tags references in email which currently are often referenced with a Twig part that of course doesn't exist anywhere and might be misleading. randomchars@symfony would be much better in my opinion.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
aleho
changed the title
[Mailer][Postmark] Inline images not referenced correct
7ED5
ly
[Mailer][Postmark] Inline images with CID not referenced correctly
Mar 31, 2025
aleho
changed the title
[Mailer][Postmark] Inline images with CID not referenced correctly
[Mailer][Postmark] Inline images with content ID not referenced correctly
Mar 31, 2025
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
6.4
Description
The fix #59836 for bug #59819 broke attaching inline images to emails from Twig if that part has a CID.
Before the change an attachment would look like this:
Now when the same image is attached this is the resulting source:
It might seem correct to set a CID, but this is only works for attachments if they don't have a content ID. "ad-hoc" attachments using Twig broke here if that part (for whatever reason) has a content ID which will always differ from the filepath.
The problem is that the resulting markup is still referencing the "old" CID:
<img src=3D"cid:@assets/img/email-bg.png" …
.I guess this might have been the reason why the filename was used for
ContentID
instead of actually usingDataPart::getContentId()
.How to reproduce
Attach an image part with a CID to an email using
email.image
in Twig. Send templated email with Postmark API.Possible Solution
A valid fix (apart from reverting the PR) might be updating
WrappedTemplatedEmail::image
to actually use the CID of the image part it attaches. I tested this with local Maildev and a real Postmark API transport, but there might be problems I'm not thinking about. This would also "improve" image tags references in email which currently are often referenced with a Twig part that of course doesn't exist anywhere and might be misleading.randomchars@symfony
would be much better in my opinion.Additional Context
No response
The text was updated successfully, but these errors were encountered: