PHP - Sending an HTML Message
Friday, February 16th, 2007Sending an HTML message is very similar to sending a plain text message.
The important difference is the message header.
$Recepient = "somebody@somewhere";
$MsgSubject = "Message subject";
// You must set sender through message header
$MsgHeader = "From: Sender name<sender@server>\n";
// You need these two lines
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=us-ascii\n";
// Message body is HTML
$MsgBody = "
<html>
<head>
<title>HTML message</title>
</head>
<body>
<h2>Congratulation!</h2>
<p>You have just learned how to send a HTML message</p>
</body>
</html>";
mail($Recepient, $MsgSubject, $MsgBody, $MsgHeader);
?>
Content management system, or CMS, is a very common web application type. The main idea is to enable site administrator to easily change the content of a web site, without need to know anything about web design and web development process. Usually, CMS provides easy-to-use interface for changing the web site content.