Forum Moderators: coopster
I wish to insert a line break (carriage return) in an email that I'm sending using PHP. I tried '\r\n'. This didn;t work so I googled for a solution but can't find out how to do it. It must be really simple but I don't know how.
Thanks, Pete
Ed
<?php
$fullmessage = "
Dear " . $fname . "
Welcome to the newsletter.
This month, blah blah blah
". $_POST[message] . "
";
} else {
$fullmessage = $_POST[message];
}
mail("$email_addr", "$_POST[subject]", $fullmessage, $headers);
}
echo "<center>email sent!</center>";
?>
are you sure you are using \r\n correctly? that's what i use all the time, and i haven't had any problems with it. an example follows:
<?php
$mail = "Dear ".$username.",\r\n\r\n";
$mail .= "Welcome to our web site.\r\n\r\n";
$mail .= "Web Site Team";
mail($usermail, "Welcome", $mail, "From: me@me.com\r\nReturn-Path: me@me.com")
?>
More reading on the subject: Strings [php.net]