Laravel image in email

2.1k views Asked by At

I am trying to attach an image to the email by which can not be show image

This code notification

return (new MailMessage)
        ->from(config('mail.username'))
        ->subject('Reset Password')
        ->greeting('<img src="http://test.test/img/header/mail_head_en.jpg">')
        ->line('You are receiving this email because we received a password reset request for your account.')
        ->line('Your E-mail address ' . ' : ' . $notifiable->email)
        ->action('Reset Password', route('vendor.password.reset', $this->token . '?email=' . urlencode($notifiable->email)))
        ->line('If you did not request a password reset, no further action is required.');

but ,not show image to email

enter image description here

2

There are 2 answers

0
Jaskaran Singh On BEST ANSWER

in your terminal or cmd run this command:

php artisan vendor:publish --tag=laravel-notifications

now go resources/views/vendor/notifications/email.blade.php on line no 4

Change

{{ $greeting }}

to

{!! $greeting !!}
0
Mahbub On

Change greeting section of your mail view file from {{ $greeting }} to {!! $greeting !!}