Transform Your Laravel Mail: Parsing Raw HTML That Really Works

How to parse raw HTML in Laravel markdown mail

Transform-Your-Laravel-Mail-Parsing-Raw-HTML-That-Really-Works

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 :

Parse raw HTML in Laravel Mail (100% working)


After : (userMailTemplate.blade.php)

@component('mail::message')
# Content

{!! $email_content !!}

{{ config('app.name') }}
@endcomponent


Output :

Parse raw HTML in Laravel Mail (100% working)


Previous Post Next Post

Contact Form