How to connect email images on laravel 5.3 using Mail Facade?

I have an image on a mail template, but when I send it, it does not carry an image. what should I do.

HTML template

<img src="/img/blahblah.jpg"> //this image does not display on receiver of mail

App \ Mail \ Subscribe

public function build() {
  return $this->view('mail.subscribe');
}
+4
source share
2 answers

To embed an inline image, use the insert method in the $ message variable in the email template. Laravel automatically makes the $ message variable available for all your email templates, so you don’t have to worry about manually passing it

<img src="{{ $message->embed($pathToFile) }}">

https://laravel.com/docs/5.3/mail#inline-attachments

+5
source

asset, URL- :

<img src="{{ asset('img/blahblah.jpg') }}">

URL- asset, (HTTP HTTPS)

docs.

+2

Source: https://habr.com/ru/post/1663846/


All Articles