Laravel: how to embed images in email as content, not as an attachment

I was looking for ways to embed an image in an email sent from Laravel. The method I found that most people use is to insert an image as an attachment.

<img src="{{$message->embed(asset('assets/img/logo.png'))}}" style="padding:0px; margin:0px" /> 

Is there a way to embed an image without binding? I tried converting the image to base64 strings, but that didn't even work.

+8
email laravel laravel-4
source share
1 answer

Is it good or not ...

You have almost none. I suppose the problem is that the asset() function generates the full URL, and Laravel the path to the file. Official document

Try the following:

 <img src="{{ $message->embed('assets/img/logo.png') }}" style="padding:0px; margin:0px" /> 
+12
source share

All Articles