Support the ongoing development of Laravel.io →
Views Forms Mail

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?

Last updated 3 years ago.
0

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);
0

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)
0

on displaying the the data on your email template just use {!! $data !!} ...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Zolax zolax Joined 21 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.