Page 1 of 1

HTML tags show in email

Posted: Wed Aug 22, 2007 10:45 am
by aceconcepts
Hi,

I have finally got my mail() working. However, when I receive the email all the HTML tags show.

Below is the code used to generate the email.

Please note:

$guestMsg is just plain text from a textbox.

$guestByTel is a boolean value used to determine whether the user selected a checkbox element.

Code: Select all

$to = "nick@q2q.co.uk";
		$subject = "Message from Q2Q web site";
		$message="<html><body>";
		$message.= "<div>" . $guestMsg . "</div>";
		//CHECK GUEST CONTACT PREFERENCE
			if($guestByTel==1)
			{
				$message .= "<br /><br /><div><span style=\"font-weight:bold;\">" . $guestName . " has made a request to be contacted by telephone.</span></div>";
			}
		$message.="</body></html>";
		$from = $guestEmail;
		$headers = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=ISO-8859-15";
		$headers .= "Content-Transfer-Encoding: 7bit";
		$headers = "From: {$from}";
		$headers .= "Reply-To: {$from}";
		$headers .= "Return-Path: {$from}";
		mail($to,$subject,$message,$headers,"-f $from");

Posted: Wed Aug 22, 2007 10:52 am
by feyd
You're missing carriage returns in your headers.. ;)