This is my php code. It gives me the Web page in EMAIL. But it does not give it in HTML FORMAT. It gives HTML TAGS too in the email.
How do I get this sorted?
<?php
// [url]http://www.zend.com/zend/trick/html-email.php[/url]
//add From: header
$headers = "From: [email]postmaster@website.com[/email]\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("HTMLDEMO");
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" . "; boundary = $boundary\r\n\r\n";
//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
//plain text version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("This is the plain text version!"));
//HTML version of message
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("This the <b>HTML</b> version!"));
/* recipients */
$to = "nainil@eliteral.com" . ", " ; // note the comma
$to .= "nainil@gmail.com";
$today = date("F j, Y, g:i a");
/* subject */
$subject = "$today Zend Website Details";
$inside_msg = file_get_contents("http://www.zend.com");
/* message */
$message = "This is an HTML EMAIL
<html>
<h1>
This is BIG
</h1>
$inside_msg;
";
if ( mail($to, $subject, $message, $headers) ) {
echo "The email has been sent!";
} else {
echo "The email has failed!";
}
// mail($to, $subject, $message, $headers);
?>