I am a comfortable developer, so when I met connect my application with Sendgrid request, I knew the Laravel’s mail driver will be the right way.

I have found this great package which just in a few steps connects your application with Sendgrid and you can enjoy convenience of using Laravel.

However, in the documentation there is used Mail facade:

and I want to use Mailable class ( and here the question comes: How can I pass the embedded data or use the template ID? Let’s see.

If I take a look at the Illuminate\Mail\Message class, I will find this method:

This is the way how the data can be embedded. But in the Illuminate\Mail\Mailable there is nothing about embedding data.

Well, we need to create Swift_Image instance ourselves and pass that as a withSwiftMessage method’s callback:

Probably I’m going to create a pull request for the possibility to add the embedded data with the Mailable class. I will update this post when I create the PR.

Read more

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Ok