vendredi 31 mars 2017

Laravel 5.3 - No break between lines in email?

I send an email out via the toMail channel, which is saved from a text area where I hit enter twice for new line, so it looks like this in the input:

Line 1

Line 2 with space above and below

Line 3

When I use that text in the mail like this:

return (new MailMessage)->subject('test spacing')
                        ->line($this->text);

It looks like this in the email:

Line 1 Line 2 with space above and below Line 3

I changed the relevant section in email.blade.php from:

@foreach ($introLines as $line)
  
@endforeach

To:

@foreach ($introLines as $line)
  {!! nl2br(htmlspecialchars($line)) !!}
@endforeach

But that still didn't work. In the notifications table in the db, it is saved as:

Line 1\n\nLine 2 with space above and below\n\nLine 3

Any idea how to get the sent email to show the spacing so it's not just one big blob?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire