New lines (\r\n) are not working in email body

In order to include new lines in the body of an email sent with PHP, you will need to use the proper new line characters. In PHP, the new line characters are \r\n.

Watch a course Learn object oriented PHP

Here is an example of how you can use new lines in the body of an email:

<?php

$to = "[email protected]";
$subject = "Test Email";
$message = "This is a test email.\r\nThis is the second line.\r\nThis is the third line.";
$headers = "From: [email protected]";

echo $message;

Make sure that you are using the proper new line characters and that you have included the appropriate $headers in your mail() function. If you are still having trouble, you may want to check that your server is configured to send email properly.