I'm writing a PHPEmailer file and I have isHTML
set to true and I also have this to format 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 is coming out like this:
Name: John Doe Company: Coca Cola Phone: 5552345678 Address: 123 Main St City: New York State: NY Zip: 17011 Inspirational Link: Inspirational Link: Inspirational Link: Inspirational Link: Project Details: a sample text
What I want is each of those fields in its own line
When you set isHTML
into true
for PHPMailer, it would not take effect at output time, as you state in the comments to your question. It only sets the flag to send a header section indicating the e-mail is an HTML one: Content-type:text/html;
, nothing else.
So what you actually need to do is to replace all your \r\n
with <br>
tag, otherwise you don't get your line breaks.
\r\n
in HTML doesnt mean anything; you need a <br>
tag instead
\r\n
could still be useful for readability of the source HTML, but it will not produce line breaks in the HTML output
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With