Lars-Janssen's avatar

Show html in blade email

Hi,

I'm trying to show html in an email that is being made with trix editor.

@foreach ($outroLines as $line)
    <p style="{{ $style['paragraph'] }}">
        {{ html_entity_decode($line) }}
    </p>
@endforeach 

But when I receive the mail I see the plain html.

What could be the case?

0 likes
13 replies
m7vm7v's avatar

delete

{{ html_entity_decode($line) }}

and try

{!! html_entity_decode($line) !!}
AddWebContribution's avatar

Have you tried: {!! html_entity_decode($line) !!}

Hope this work for you..! If not, what's the error given.

For testing, try and check:

@foreach ($outroLines as $line)
   <?php
       print('<pre style="color:red;">');
       print_r($line);
       print('</pre>');
   ?>
@endforeach
AddWebContribution's avatar

@lars6: If $line contain <div>test</div>, {!! $line !!} should be work. If still not working then review the problem and update question as per.

WebDo's avatar

@lars6 Please check if "laravelcollective/html": "5.3.*" package installed in your project. You can check it in composer.json file. If it is not installed, make it install and html will work like charm.

Thanks,

Please or to participate in this conversation.