movepixels
1 week ago
117
3
Laravel

Mailer blade with embed error

Posted 1 week ago by movepixels

I have a blade email template with embedded header footer images that work fine when sending the email direct from a controller method , so its not an issue with wrong image path.

Now I have moved the sending of the email thru a dispatch / job approach but the images trigger an error now.

Unable to open file for reading [img/email/email_footer.jpg] {"exception":"[object] (Swift_IoException(code: 0): Unable to open file for reading [http://localhost/img/email/email_footer.jpg] at /Users/oxygen/www/zeductive/api/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php:131)

Tried serching online and tried all tips but nothing works when pushing it thru a Mailable

Blade Snip:

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

or

$message->embed('img/email/email_footer.png')

But still same error.

Anyone know how to embed an image inline when that email is going to be sent thru a Mailable.

The mailer build looks like:

public function build()
    {
        //return $this->view('emails.invitations.invite');
        return $this->subject('Invitation')
          ->replyTo('[email protected]')
          ->from('[email protected]', 'xxx.com')
          ->view('emails.invitations.invite_test');
    }

Any help would be appreciated,

Dave

Please sign in or create an account to participate in this conversation.