laravelmailtrap

Why checking in mailtrap results of email html tags are not rendered?


In Laravel 10 app sending an email with notification I use salutation method wuth string value from database seetings:

->salutation(PHP_EOL . $supportSignature);

which has line breaker html tag, like

Best Regards,<br>    Support of News Publisher Team

Checking in mailtrap results I see that

“<br>” 

is not rendered :

enter image description here

I tried to replace line breaker html tag with code :

->salutation(PHP_EOL . \Str::replace(['<br>', '<br/>'], PHP_EOL, $supportSignature));

But in this case all text :

Best Regards, Support of News Publisher Team

Is on the same line.

In which way can I make such way valid for more of current email services? I suppose there are too few email service boxes not supporting html tags?

Not sure, but is this feature of mailtrap ?


Solution

  • This is probably not an issue with mailtrap, but rather regarding how to add line breaks within the salutation function.

    You can try using HtmlString() inside salutation() and check if it works.

    ->salutation(new HtmlString("Best Regards,<br> Support of News Publisher Team"));
    

    Check out this stackoverflow question as well, it should mostly help.