I wonder why this code won't work:


$content = $email."\n".$phone."\n".$select;

I expect that it goes to the next line after \n

when you set header("Content-Type:text/plain"); or use it inside pre echo '<pre>'.$content.'</pre>;` then it should be work fine

commented: Good advice +15
Member Avatar

Just like to add - I'm seeing a lot of issues with \n lately. If you use this as part of general html output, it will help to prettify the underlying html (e.g. see source view), but very little else. To actually see the newline as part of output to the screen, you need to do as shown by AndrisP. Be aware \n is not the same as the html <br />.

You could always use the PHP_EOL constant, which is a better platform-independent fit IMO:

$content = $email.PHP_EOL.$phone.PHP_EOL.$select;

I don't understand where to write:


I already try place it in the HomeController.php (the space does not work) and email.blade.php template (it actually prints the codes).

I also try using PHP_EOL, it only shows a space instead going to the next line which I expect.

Member Avatar

Do you need a text newline or a html break?

Member Avatar

HomeController not the place to put this I wouldn't think. Shouldn't it be in your email template?
Makes sense to make that plain text.