I'm using the default notification system (Laravel 5.3) to send an email. I want to add HTML tags in message. This does not work (it displays the strong tags in plain text):
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Info')
->line("Hello <strong>World</strong>")
->action('Voir le reporting', config('app.url'));
}
I know it's normal because text is displayed in {{ $text }}
in the mail notification template. I tried to use the same system as in csrf_field()
helper:
->line( new \Illuminate\Support\HtmlString('Hello <strong>World</strong>') )
But it does not work: it displays strong as plain text.
Can I send HTML tags without changing the view? (I don't want to change the view: protecting text is OK for all other cases). Hope it's clear enough, sorry if not.