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

Inline Images not embedded in Mail Preview #48808

Closed
tkempf opened this issue Oct 24, 2023 · 3 comments
Closed

Inline Images not embedded in Mail Preview #48808

tkempf opened this issue Oct 24, 2023 · 3 comments

Comments

@tkempf
Copy link

tkempf commented Oct 24, 2023

Laravel Version

10.15.0

PHP Version

8.1.18

Database Driver & Version

No response

Description

Mailables which have inline images embedded by
{!! $message->embed(public_path($storagepath.'/img/image.jpg')) !!}
do not have the binary Data embedded when the preview is rendered in the browser by the render() method.
The Images are embedded correctly in the mail when it is sent.

Steps To Reproduce

  1. Generate a mailable where an image is embedded in the view-template via $message->embed() method.
    i.e. <img src="{!! $message->embed(public_path($storagepath.'/img/image.jpg')) !!}" />

  2. send mail to check that the image is visible in the mail

  3. preview mail in the browser as explained here https://laravel.com/docs/10.x/mail#previewing-mailables-in-the-browser

  4. Image is not shown in the preview. The Source in the image-tag is src="cid:imageid", but the corresponding data-part is missing in the output

@github-actions
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@phpfour
Copy link
Contributor

phpfour commented Oct 26, 2023

Hey @tkempf, this issue has been fixed in this PR: #48292. You can update your Laravel version and it should be working. Here's my test results:

resources/views/emails/document_uploaded.blade.php

<body>
    A new document has been uploaded to the system. <br><br>

    <img src="{!! $message->embed(public_path('storage/head_first_sql.png')) !!}">
</body>

CleanShot 2023-10-26 at 10 44 14

Cheers!

@tkempf
Copy link
Author

tkempf commented Oct 26, 2023

Oh, i must have missed this one. Allthough i searched the issues for the described behaviour.
Since this is already fixed, i close this issue .
Sorry for the noise and Thankyou Mohammad!

@tkempf tkempf closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants