Here is my current script:
$toemail = "$appemail";
$subject = "Bursary Application";
$headers = "MIME-Version: 1.0\r\n"
."From: Tem <[email protected]>\r\n"
."Content-type: text/html; charset=ISO-8859-1\r\n";
$body = "<h3>Thank You ".$appfirstname." for applying for the Bursary.</h3>"
."<hr />"
."<h2>Bursary Application Form</h2>"
."<hr />"
."<h4>Application Date: ".$appdate."</h4>"
."<h4>First Name: ".$appfirstname."</h4>"
."<h4>Last Name: ".$applastname."</h4>"
."<h4>Birthdate: ".$birthdate."</h4>"
."<h4>Mailing Address: ".$appmailingaddress."</h4>"
."<h4>City: ".$appcity."</h4>"
."<h4>Province: ".$appprovstate."</h4>"
."<h4>Postal Code: ".$apppc."</h4>"
."<h4>Phone Number: ".$appphone."</h4>"
."<h4>Graduation Date: ".$graddate."</h4>"
."<h4>Email Address: ".$appemail."</h4>"
."<h4>Post Secondary Plans: ".$psplans."</h4>"
."<h4>Musical Accomplishments: ".$ma."</h4>"
."<h4>Hobbies: ".$hobbies."</h4>"
."<h4>Why I enjoy music: ".$why."</h4>"
."<h4>How I will use the monetary award: ".$how."</h4>"
."<h4>What I would say to the donor: ".$saydonor."</h4>"
."<br>"
."<br>"
."<hr />"
."<h4>Thank you for your application.</h4>"
."<br>"
."<br>"
;
mail($toemail, $subject, $body, $headers);
I am getting the data from the form and using text fields for the paragraph answers. I am sending this in the form as test data $psplans. There are carriage returns after each number:
1)Line 1 2)Line 2 3)Line 3
I am getting this in the body of the emailed message:
Post Secondary Plans: 1)Line 1\r\n2)Line 2\r\n3)Line 3
I cannot find a way to eliminate the \r\n. Your help would be appreciated. :)
You're outputting html in the email, not text. A newline in the source code of html does not appear as a line break in the output.
You can simply use the php function nl2br: http://php.net/manual/en/function.nl2br.php
to change the line
."<h4>Post Secondary Plans: ".$psplans."</h4>"
to
."<h4>Post Secondary Plans: ".nl2br($psplans)."</h4>"
or use the <br>
tag yourself instead of the \n\r
sequence where you insert it already.