eduardokum / laravel-mail-auto-embed

MIT License
166 stars 36 forks source link

Support for original base64 images #60

Open baaskoen opened 4 weeks ago

baaskoen commented 4 weeks ago

Thanks again for this great library!

I would like to propose a new addition for the attachment method.

Issue

If you send an e-mail which which contains an image in its body, it will go through the different checks as seen here:

https://github.com/eduardokum/laravel-mail-auto-embed/blob/ee17be8f4a221593190ca949a1fb036c6884fc2c/src/Listeners/SymfonyEmbedImages.php#L197

However, if the original image was already a base64 encoded src, it will not be converted to an embedded image, resulting into clients like Gmail not rendering the image.

Proposal

Add a check for when the image src starts with data:*;base64. When this is the case, embed the image anyway.

baaskoen commented 4 weeks ago

I added a MR in a fork which works for me personally. Not tested properly though:

https://github.com/eduardokum/laravel-mail-auto-embed/pull/61/files