Re: html email showing <br> instead of line breaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Have you tried http://es.php.net/manual/en/function.nl2br.php ?

I think it's easier and fits your needs.




________________________________
De: Adam Williams <awilliam@xxxxxxxxxxxxxxxx>
Para: PHP General list <php-general@xxxxxxxxxxxxx>
Enviado: jueves, 24 de septiembre, 2009 20:52:13
Asunto:  html email showing <br> instead of line breaks

I have users enter support tickets into a a <textarea> form and then it emails it to me, I'm trying to get the emails to display when they hit enter correctly, so i'm changing the \r\n to <br>, but in the email i'm getting, its displaying the <br> instead of a line break:  here is the code:

$message = "<html><head><title>new support request #".mysqli_insert_id($mysqli)."</title></head><body><p>
Hello, ".$_SESSION["full_name"]." has created a  new support request.  Please log in at <a href=\"http://intra/helpdesk\";>MDAH Helpdesk</a>. The problem request is \"";
$message .= htmlspecialchars(str_replace('\r\n', '<br>', $_POST["problem"]));
$message .= "\" and the best time to contact is \"".htmlspecialchars($_POST["contact_time"])."\" </p></body></html>";
               $headers  = 'MIME-Version: 1.0' . "\r\n";
               $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
               $headers .= "From: ".$_SESSION["full_name"]."<".$_SESSION["username"]."@mdah.state.ms.us>" ."\r\n" .
               "X-Mailer: PHP/" . phpversion();
              mail('isstaff@xxxxxxxxxxxxxxxx', $subject, $message, $headers);

but the email I get is:

Hello, Karen Redhead has created a new support request. Please log in at MDAH Helpdesk <http://intra/helpdesk>. The problem request is "Elaine is out today but her computer no longer has Past Perfect from what I can tell. Also how does she access her email. The Sea Monkey email icon does not take you anywhere.<br>Thanks so much,<br>Karen" and the best time to contact is "1:30 -5:00"


How come the email is being displayed with <br> instead of line breaks?


      

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux