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

From: Date: Thu, 24 Sep 2009 18:55:42 +0000
Subject: Re: html email showing <br> instead of line breaks
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298332@lists.php.net to get a copy of this message
\r\n should be between double quotes: "\r\n" On Thu, Sep 24, 2009 at 3:52 PM, Adam Williams <awilliam@mdah.state.ms.us> wrote: > 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@mdah.state.ms.us', $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? > >

« previous php.general (#298332) next »