Jump to content

Formatting email message in PHP


FredFogg

Recommended Posts

I am using php to send a text email and I am populating the message and I have tried a couple examples I found on the internet, but it isn't working. It is a simple email, so no need to send in html format. Here is what I have

 

$email_msg = 'Email : ' . $Email;

$email_msg .= '\n' .'First Name : ' . $FirstName;

$email_msg .= '\n' . 'Last Name : ' . $LastName;

 

and the email I am getting

 

Email : [email protected]\nFirst Name : john\nLast Name : smith

 

what I want is

 

Email : [email protected]

First Name : john

Last Name : smith

 

What am I doing wrong or do I need to add something to the header?

Link to comment
https://forums.phpfreaks.com/topic/200513-formatting-email-message-in-php/
Share on other sites

Ok, that fixed the formatting, but caused my variables not to print:

 

$email_msg = 'Email : ' . $Email;

$email_msg .= "\n" . 'First Name : ' . $FirstName;

$email_msg .= "\n" . 'Last Name : ' . $LastName;

 

results in:

 

Email :

First Name :

Last Name :

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.