Skip to content

Conversation

@yinheli
Copy link

@yinheli yinheli commented Oct 31, 2025

This PR fixes incorrect usage of the DataPart constructor in embed() and embedData() methods. The second parameter of DataPart is filename, not Content-ID. DataPart generates its own Content-ID automatically.

@yinheli yinheli force-pushed the fix/embed-datapart-api-misuse branch 2 times, most recently from cd89b2b to 75bd0b0 Compare October 31, 2025 07:52
{
Mail::to('test@mail.com')->send($mailable = new EmbedDataMailable());

$mailable->assertSeeInHtml('Embed data content: cid:foo.jpg');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it’s removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cid is now automatically generated by DataPart as a random value, so it's been removed. Alternatively, should we just check for the existence of cid instead?

$mailable->assertSeeInHtml('Embed data content: cid:');

Any better suggestions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, yes we should check cid existence at least as you mentioned instead of removing the check totally.

Thanks

@yinheli yinheli force-pushed the fix/embed-datapart-api-misuse branch from 75bd0b0 to 6006207 Compare October 31, 2025 10:34
@taylorotwell
Copy link
Member

No associated issue or reproduction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants