php - How to attach a Laravel blade view in mail -
i'm trying attach blade view when send mail. i'm using laravel 4. tried this:
mail::send( "emails.clientemail", $data, function($message) use ($data,$template,$subject) { $message->to($data['email'], $data['name']) ->from($template['from'],$template['from_name']) ->subject($subject) ->attach(app_path().'/views/email.blade.php'); } );
but view email.blade.php
in blade template , doesn't display html code.
how should send , display html?
as metioned can use attachdata
, add rendered data like:
$rendereddata = view('email')->render(); mail::send( "emails.clienteail", $data, function($message) use ($data,$template,$subject) { $message->to($data['email'], $data['name']) ->from($template['from'],$template['from_name']) ->subject($subject) ->attachdata($rendereddata, 'name_of_attachment'); } );
Comments
Post a Comment