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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -