Home > Enterprise >  Line breaks not working properly with Laravel Text Emails / Testing in Mailhog
Line breaks not working properly with Laravel Text Emails / Testing in Mailhog

Time:09-27

If I understood correctly, in laravel text emails it is not necessary to add "\n" for example,

but it seems that, some times the "enters" ( new lines ) I add work properly, sometimes not.

I've been trying to figure it out anc it is a mystery, seen some people with the same issue but haven't found a solution yet.

Some examples/tests below:

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

Edit:

HTML is not being used! I'm calling ->text( and not->view(:

enter image description here enter image description here

CodePudding user response:

Added 2 spaces BEFORE the line break, Issue solved.

CodePudding user response:

You are using Blade Template from Laravel, and Blade uses html tags. In your case, since you are using HTML anyway, why not use breaklines, paragraphs, divs or anything that is a block element so that you can efficiently add a newline.

<p>
<br>
<div>

Or much better approach is to use Markdown template for Emails as documented from official Laravel page, Markdown mailables

  • Related