-1

I have tried adding \n or \r\n to the following code but it doesn't work. Any ideas please?

'booking_notice' => 'Booking details below. Payment receipt was sent in a separate email.\r\nThank you for booking with us!',
JESSE
  • 21
  • 5
  • 1
    Is the email being sent with the Content-type: text/html header? If so, the email body is being rendered as html and you'll need to use
    or other tag.
    – serverSentinel Mar 08 '21 at 21:50
  • Hi yes the email being sent is with that content type. However this file is also use for labels on front end html php render code. And "\r\n" not working on front end? – JESSE Mar 08 '21 at 21:55
  • because HTML doesn't care about white space, you would have to convert them to `
    `s
    – lagbox Mar 08 '21 at 21:58
  • Sounds like it's the same problem. \r\n needs to be a
    to render a new line in HTML.
    – serverSentinel Mar 08 '21 at 21:59
  • Hi, I tried the following code: ` 'booking_notice' => 'Booking details below. Payment receipt was sent in a separate email.'."
    ".'Thank you for booking with us!',` keep in mind this is a php language file for a PHP Laravel 5.4 web base app. The email output is as follow: Booking details below. Payment receipt was sent in a separate email.
    Thank you for booking with us!
    – JESSE Mar 08 '21 at 22:13

1 Answers1

1

That character should be in double-quotes for it to work as a line break:

'booking_notice' => 'Booking details below. Payment receipt was sent in a separate email.'."\r\n".'Thank you for booking with us!',

Alternatively you can use the constant PHP_EOL but keep in mind the value that is used is platform dependent.

See this link for a list special characters that PHP interprets from double-quoted strings: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double

cOle2
  • 4,725
  • 1
  • 24
  • 26
  • I tried the double quotes but for some reason the output it's still the same? Is not adding a return. I basically want the sentence: Thank you for booking with us! To be on a whole separate line below the first sentence. Any ideas? – JESSE Mar 08 '21 at 21:41
  • @JESSE Maybe your email gets sent as HTML. In that case you would use a `
    ` tag instead of the line break characters.
    – cOle2 Mar 08 '21 at 22:05
  • @ cOle2 I tried this instead: 'booking_notice' => 'Booking details below. Payment receipt was sent in a separate email.'."
    ".'Thank you for booking with us!', however the output is: Booking details below. Payment receipt was sent in a separate email.
    Thank you for booking with us! on the email.
    – JESSE Mar 08 '21 at 22:15