I like to add some html tags to the body of my mail using MailMessage like this:
$mailMessage = new MailMessage();
$mailMessage->line(trans('mail.someLine') );
In mail.php:
'someLine' => 'Bla bla <a href="html://someurl">html://someurl</a>'
But in the actual mail the entire line comes out as plain text.
I've tried to use html_entity_decode
but without any success:
$mailMessage->line(html_entity_decode(trans('mail.someLine')));
Seems like the line method does it's own encoding. Is there a workaround for this?
ps The rest of the mail has proper html so that's not the point!
update:
$mailMessage->action won't do in this case. Let say it should work for something like this as well:
$mailMessage->line('Bla bla <strong>something strong</strong> bla');
Better to use HtmlString
class.
use Illuminate\Support\HtmlString;
return (new MailMessage)
->line(new HtmlString($someHtmlBody));
Line will be show as processed HTML code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With