Hello everyone, I'm trying to send email with beautiful html style I use wysiwyg editor to send email. When I receive an email I have this format: <h2> Hello </h2> instead of heading Hello string. There is my controller:
$inputs = $request->all();
$mail = Mail::send('emails.welcome', array('body' => $inputs['body'], 'title'=>$inputs['subject']), function($message)
{
$message->from(Auth::user()->email, Auth::user()->name);
$message->to(Input::get('email'))->subject(Input::get('subject'));
});
My view:
<html lang="en-US">
<head>
<meta charset="text/html">
</head>
<body>
Subject: {{$title}}
Message body:
{{$body}}
</body>
</html>
How can i get in email html formatting?
It is kind of mentioned in the docs. See: http://laravel.com/docs/5.0/mail
// You assign html or text as the key to do HTML or Text email
Mail::send(['html' => 'view'], $data, $callback);
Thanks for reply but when I used it and I got the same result as before.
$mail = Mail::send(['html' => 'emails.welcome'], array('body' => $inputs['body'], 'title'=>$inputs['subject']), function($message)
on displaying the the data on your email template just use {!! $data !!} ...
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community