Awar Pulldozer
Awar Pulldozer

Reputation: 1101

laravel mail function not render html tags

8 and in my controlller i have this code

    $users = User::where('user_type','=',3)->get();
    return Mail::send(['text'=>'emails.sallery'],['$users' => $users],function($message){
        $message->to('[email protected]','awad')->subject('test email');
        $message->from('[email protected]','awad alsharif');

    });

and this is my blade code

<h1>asdfadsfasdf</h1>

now in gmail the mail will come not as h1 will come like this

<h1>asdfadsfasdf</h1>

without rendering the html tags any help here thanks

Upvotes: 1

Views: 1689

Answers (2)

Nurul Huda
Nurul Huda

Reputation: 1573

Try to use this code instead:

$users = User::where('user_type','=',3)->get();

Mail::send('emails.sallery', ['users' => $users] , function($message) {
   $message->to('[email protected]','awad')->subject('test email');
   $message->from('[email protected]','awad alsharif');
});

Upvotes: 1

Mohammed Aktaa
Mohammed Aktaa

Reputation: 1353

please can you put it into html template not like what you have sent like this maybe:

<!doctype html>
 <html lang="en">
 <head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Mail</title>
 </head>
 <body>
    <h1>asdfadsfasdf</h1>
 </body>
 </html>

Upvotes: 0

Related Questions