How to parse raw HTML in Laravel markdown mail
In this article we will learn how to parse raw HTML in Laravel email. Laravel provides lots of solutions to work with its blade files, in many cases there is a requirement to parse raw html in our blade file or laravel mailer file .
Quick Solution :
{!! $mail_content !!} // $mail_content variable contains your raw HTML
Example :
In this example we will see how to parse raw HTML in Laravel Mail. Your controller code and Mail functions will be the same we only change the final mail blade file as below .
Before : ( userMailTemplate.blade.php )
@component('mail::message') # Content {{ $email_content }} {{ config('app.name') }} @endcomponent
Output :
After : (userMailTemplate.blade.php)
@component('mail::message') # Content {!! $email_content !!} {{ config('app.name') }} @endcomponent
Output :
Thank you for reading this article 😊
For any query do not hesitate to comment 💬