html mail

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I had been trying to send a html email from the folowing script that i
took from zend site and modified. Its working fine, but it sends some
garbage in the end of the mail.
I had posted this msg on the zend and other forums and also read this
forum with some similar msg. They talked about encoding I think there
is some problem in the encoding. I will be very thankful to someone
who can currect the script. Remember currect, I dont want to know what
am i Doing wrong this is because I am so tierd of trying them. Please
I will be thankful,  I understand that i should learn where am I going
wrong but I tried all suggestions may be I am not doing it the right
way. I will be thankful if someone can currect it or mail me the
similar script that works fine to



$headers = "From:\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
$headers .= "Content-Type: multipart/alternative" . "; boundary =
$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
$headers .= "--$boundary\r\n" . "Content-Type: text/html;
charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$name = stripslashes($HTTP_POST_VARS['name']);
$email = stripslashes($HTTP_POST_VARS['email']);

$msg = "<b>Name:</b> " .
$name . "\nEMail: " . $email;

$headers .= chunk_split(base64_encode("$msg"));

$msg , $headers);
if($sent == true) {
header('Location: send.htm');
if($sent == false) {
header('Location: notsend.htm');


Re: html mail


On 07/14/2004 08:11 PM, Jaunty Edward wrote:
Quoted text here. Click to load it

It seems you are mistaking the message headers and body data.

Anyway the example in the Zend site encourages you to a bad practice
that may make your messages end up being discarded by spam filters.

HTML messages should always have an alternative text part that is
displayed for people with HTML capable mail programs. Without an
alternative text part the message does not look like it was sent by a
user using a real mail client, and so less tolerant spam filters discard it.

The correct way to do it is to compose multipart/alternative. If you
want to know how to send such messages without much effort, you may want
to tr this class that even comes with an example on how to compose and
send HTML messages properly:


Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP /

PHP Reviews - Reviews of PHP books and other products /

Metastorage - Data object relational mapping layer generator

Re: html mail

thanks for the help, I got a script that works fine, if any one is
future want a script for mail me i will mail you.

Site Timeline