I've created some functionality to manage email campaigns. I use summernote to edit the email templates.
Like most editors, Summernote stores images as base64 encoded image tags.
The issue that I have is when I want to send out the email, most mail clients don't render the base64 image tag. Therefore I'd need to use:
<img src="{{ $message->embed($pathToFile) }}"> or <img src="{{ $message->embedData($data, $name) }}">
According to the Laravel documentation:https://laravel.com/docs/5.7/mail#inline-attachments
The issue is that the mail class requires a set view
return $this->from('example@example.com')->view('emails.orders.shipped');
What is the best way to get the inline images from summernote into the email view? (Note that the email can contain multiple images and each template differs)
The current mail functionality basically expects your view to have the embed functions already in your view. But in this case, I need to dynamically set it.
The only thing that I got working was to isolate the images in the summernote value (data saved from textarea) and re-create them as images on disk. Then to generate a view dynamically with the image paths (embed($pathToFile) }}"> ) already written to the dynamic view. Then injecting that dynamic view into the email.