\ n does not give me a new line in my HTML

I am writing a PHPEmailer file and I am isHTMLset to true, and I also have this for formatting my output:

$mail->Body = 
    "Name: " . $_POST['quote_name'] . 
    "\r\n\r\nCompany: " . $_POST['quote_company'] . 
    "\r\n\r\nPhone: " . $_POST['quote_phone'] . 
    "\r\n\r\nAddress: " . $_POST['quote_address'] . 
    "\r\n\r\nCity: " . $_POST['quote_city'] . 
    "\r\n\r\nState: " . $_POST['quote_state'] . 
    "\r\n\r\nZip: " . $_POST['quote_zip'] . 
    "\r\n\r\nInspirational Link: " . $_POST['quote_link1'] . 
    "\r\n\r\nInspirational Link: " . $_POST['quote_link2'] . 
    "\r\n\r\nInspirational Link: " . $_POST['quote_link3'] . 
    "\r\n\r\nInspirational Link: " . $_POST['quote_link4'] . 
    "\r\n\r\nProject Details: " . stripslashes($_POST['quote_details']);

But the email looks like this:

Name: John Doe Company: Coca Cola Phone: 5552345678 Address: 123 Main St City: New York State: New York Postcode: 17011 Inspirational Link: Inspirational Link: Inspirational Link: Inspirational Link: Project details: sample text

I want each of these fields in its row

+4
source share
5 answers

isHTML true PHPMailer, , . , , HTML-: Content-type:text/html;, .

, \r\n <br>, .

+3

\r\n HTML ; <br>

\r\n HTML-, HTML

+2

html. br.

"<br>Company: " . $_POST['quote_company'] .
+2

<br/> \r\n\r\n, HTML .

If you want to use \r\n\r\n, you will need nl2br():

<?php
    Body =  nl2br("\r\n\r\nCompany: ");
?>
+2
source

</br> is used to insert line breaks in HTML.

You can try it here .

0
source

All Articles