Can't get newline char to work in emails
Posted: Tue Sep 09, 2008 3:40 pm
Hi,
I am using mail() to send emails and I can't get newline characters (\n or \r\n) to work in the formatting of the message body.
Here is my code:
Everything else, works but in the email, the newlines just show as "/n", not new lines.
Any suggestions?
TIA,
Mike
I am using mail() to send emails and I can't get newline characters (\n or \r\n) to work in the formatting of the message body.
Here is my code:
Code: Select all
$from = 'From: ' . $_POST['customer_name'] . '<' . $_POST['customer_email'] . '>';
if ($_POST['form_num'] == '1')
{
$to = ($_POST['short_target'] == 'Sales') ? 'mike@gilsbachdesigns.com' : 'mike.gilsbach@quest.com';
$subject = 'Customer Contact, Short Form';
$body = 'This is a short form email from garmanrouting.com directed to ' . $_POST['short_target'] . '\n';
$body = $body . 'Name: ' . $_POST['customer_name'] . '\n' ;
$body = $body . 'Company: ' . $_POST['customer_company'] . '\r\n';
$body = $body . 'Phone: ' . $_POST['customer_phone'] . '\r\n' ;
$body = $body . 'Email: ' . $_POST['customer_email'] . '\n\n' ;
$body = $body . 'Message: \n' . $_POST['customer_needs'] ;
}else{
$to = 'mike@gilsbachdesigns.com';
$subject = 'Customer Contact, Detailed Form';
$body = 'This is a detailed form email.';
}
mail($to,$subject,$body,$from);Any suggestions?
TIA,
Mike