skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    Added 2 spaces BEFORE the line break, Issue solved. Make sure your IDE is not trimming spaces at the end!! Which was my case with VSCode ( not sure if some plugin or native will figure out soon )


  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search