Jump to content

Sending mail as html format


wardo

Recommended Posts

I have the following code which works fine apart from the format not coming through in HTML format. Can anyone see how I can make the email come through in html format?

[code]
$to = $_GET["email"];
$subject = "Online booking";
$message = stripslashes($message);
$message = str_replace("\n","<p>",$message);
$message = "<b>Booking Information:</b><p />Employee No:<br /><b>$eno</b> <p />Name:<br /> <b>$name</b><p />Title:<br /><b>$title</b><p />Base:<br /> <b>$base</b><p />Telephone No:<br /> <b>$tel</b><p />Course code and Date:<br /><b>$code</b><p />Title:<br /><b>$ctitle</b><p />";

$from="From: [email protected]";

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";

mail($to,$subject,$message,$from,$headers);

echo "<p /><h4>Thank you. Your message has been sent.</h4>";[/code]

Thanks for your help.
Link to comment
https://forums.phpfreaks.com/topic/34243-sending-mail-as-html-format/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.