Posted by Kenn on 09/20/05 23:32
Greetings.
I'm attempting to create an HTML email via PHP and cannot get the email
to render in the correct font. I've made several stabs at it, the most
recent one below. The same code that works just fine on a web page
won't work for me here. What am I doing wrong?
Any and all help appreciated.
Kenn
<?php
$headers = "From: webserver@localhost\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$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!"));
$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("<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<style type=\"text/css\">
<!--
h1 {color: #000000;
font-family: \"verdana\" ; }
-->
</style>
</HEAD>
<BODY>
testing<br>
<h1>TESTING 222</h1> test over.
</BODY>
</HTML>
"));
//send message
mail("kenn@thebytebusiness.com", "Another HTML Message", "", $headers);
?>
[Back to original message]
|