Sending e-mail in Laravel with custom HTML

后端 未结 5 923
死守一世寂寞
死守一世寂寞 2021-01-06 02:01

I need to send e-mails but I already have the HTML generated, I don\'t want to use laravel blade because I need to apply a CSS Inliner to the HTML, so this is how i generate

5条回答
  •  不思量自难忘°
    2021-01-06 02:15

    If I'm right in what you want to achieve, to get round this I created a view called echo.php and inside that just echo $html.

    Assign your html to something like $data['html'].

    Then below pass your $data['html'] to the echo view.

    Mail::send('emails.echo', $data, function($message) { $message->to('foo@example.com', 'John Smith')->subject('Welcome!'); });

    Let me know how you get on.

提交回复
热议问题