Contact form excludes line breaks in message body
Posted: Mon Oct 09, 2006 8:56 am
Hi,
I've got a contact form on my Flash website that sends its variables to the attached PHP script and consequently sends an email onto me. It all works perfectly except the email I receive always misses out the line breaks contained within the $yourmessage variable. For example if someone writes their address to me like this:
Joe Bloggs
10 Lime Avenue
London
UK
The email will present their address to me with the line breaks removed like this:
Joe Bloggs10Lime AvenueLondonUK
How can I resolve this issue?
Many thanks,
Leao
I've got a contact form on my Flash website that sends its variables to the attached PHP script and consequently sends an email onto me. It all works perfectly except the email I receive always misses out the line breaks contained within the $yourmessage variable. For example if someone writes their address to me like this:
Joe Bloggs
10 Lime Avenue
London
UK
The email will present their address to me with the line breaks removed like this:
Joe Bloggs10Lime AvenueLondonUK
How can I resolve this issue?
Many thanks,
Leao
Code: Select all
<?
$to = 'mail@mydomain.org';
$subject = 'St. Patrick\'s message';
$body = "You have received a message via the St. Patrick's website. The details of the message are listed below...\n\nName: $yourname\nEmail: $youremail\nMessage: $yourmessage";
$body = wordwrap($body, 70);
$headers = "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: mail@mydomain.org\r\n";
$headers .= "Return-Path:mail@mydomain.org\r\n";
$headers .= "Reply-To: $youremail\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion()."\r\n";
mail($to, $subject, $body, $headers, "-fmail@mydomain.org.org");
?>