I have created a file with name dummy.blade.php which has the following code
<!DOCTYPE html>
<html lang="en-EN">
<head>
<meta charset="utf-8">
</head>
<body bgcolor="#11C9FF">
{{$emailBody}}
</body>
</html>
And I am trying to send HTML content using:
Mail::send('emailTemplates.dummy', ['emailBody'=>'<h1>TESTING</h1>'], function($message)
{
$message->to($myEmail)->subject('Password reset');
});
And the email received is like this:
As per documentation that I should be receiving the html format but I am receiving simple text based email. Any clues?
Double curly braces escape the html inside of them, you need to use different syntax for an unescaped string.
So instead of
{{ $emailBody }}
you should use
{!! $emailBody !!}
You can read more about here: https://laravel.com/docs/5.5/blade#displaying-data