I am sure this is a stupid question but I'm tearing my hair out.
I am trying to email data that I have cleaned (from a multi-line text box) with escape_data.
The problem is the data is sent with \r\n instead of actual line breaks. Eg: message in email will read "Hello\r\nThis is the 1st parapgraph\r\n\r\nThis is another"
I have tried to remedy this below but it does not work:
if ($_POST['Information'] != '') {
$Information = escape_data($_POST['Information'], $dbc);
$Informationformatted = str_replace(array("\r\n", "\r", "\n"), "<br />", $Information);
} else {
$contact_errors['Information'] = 'Please enter your message';
}
//message in email
$body = $Informationformatted;
$headers = 'MIME-Version: 1.0'. "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From:'.$Email;
mail ('email@email.com', 'Message', $body, $headers);
I am still getting the same output: "Hello\r\nThis is the 1st parapgraph\r\n\r\nThis is another"
I have also tried $Informationformatted = nl2br($Information);
This did not work either.
(Or would be something to do with the headers?)