html_mime_mail.class - - help

From: Date: Thu, 25 Jan 2001 10:14:43 +0000
Subject: html_mime_mail.class - - help
Groups: php.general 
Request: Send a blank email to php-general+get-36592@lists.php.net to get a copy of this message
Anyone familiar with this class willing to help out. Would appreciate it. when i run the following (example.php) script, i always get what looks like the rfc822 body of the message within the e-mail, but never the html or text body body parts. first i'll show the output of the script, then the example.php script. html_mime_mail.class is attached. notice how the mime-version definition and boundary is within the message body, also notice how the text/html part has base64 encoding? this is on netscape 6, but repeatable with outlook express. again, thanks if you actually trace through this, or recognize the error otherwise. - eric ######## output (msg body) ######### MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_2ad7f0cbb98266e56a24391bd135d9a4" This is a MIME encoded message. --=_2ad7f0cbb98266e56a24391bd135d9a4 Content-Type: multipart/alternative; boundary="=_22bf429aee349f53ea3e34f8bb0149b3" --=_22bf429aee349f53ea3e34f8bb0149b3 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: base64 U3VjY2Vzcw== --=_22bf429aee349f53ea3e34f8bb0149b3 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: base64 PEhUTUw+PEJPRFkgQkFDS0dST1VORD1iYWNrZ3JvdW5kLmdpZj5lcmljZXJpY2VyaWM8L0JPRFk+ PC9IVE1MPg== --=_22bf429aee349f53ea3e34f8bb0149b3-- --=_2ad7f0cbb98266e56a24391bd135d9a4-- ######## example.php script ######### <?php /*************************************** ** Title.........: HTML Mime Mail class ** Version.......: 1.33 ** Author........: Richard Heyes <richard.heyes@heyes-computing.net> ** Filename......: example.php3 ** Last changed..: 24/10/2000 ** Notes.........: Based upon mime_mail.class ** by Tobias Ratschiller <tobias@dnet.it> ** and Sascha Schumann <sascha@schumann.cx>. ***************************************/ error_reporting(63); include('class.html.mime.mail.inc'); /*************************************** ** Example of usage. ***************************************/ /*************************************** ** Read the file background.gif into ** $backgrnd. ***************************************/ /*************************************** ** ** !! Important !! ** ** If running this script upon Windows ** then you may need to change the fopen() ** mode from 'r' to 'rb'. ** Thanks to Thomas Unger for this nugget. ***************************************/ //$filename = 'background.gif'; //$backgrnd = fread($fp = fopen($filename, 'r'), filesize($filename)); //fclose($fp); /*************************************** ** Read the file test.zip into $attachment. ***************************************/ //$filename = 'example.zip'; //$attachment = fread($fp = fopen($filename, 'r'), filesize($filename)); //fclose($fp); /*************************************** ** Create the mail object. Optional headers ** argument. Do not put From: here, this ** will be added when $mail->send ** Does not have to have trailing \r\n ** but if adding multiple headers, must ** be seperated by \r\n. ***************************************/ $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** If sending an html email, then these ** two variables specify the text and ** html versions of the mail. Don't ** have to be named as these are. Just ** make sure the names tie in to the ** $mail->add_html() command further down. ***************************************/ $text = "Success"; $html = "<HTML><BODY BACKGROUND=background.gif>ericericeric</BODY></HTML>"; /*************************************** ** Add the text, html and embedded images. ** Each embedded image has to be added ** using $mail->add_html_image() BEFORE ** calling $mail->add_html(). The name ** of the image should match exactly ** (case-sensitive) to the name in the html. ***************************************/ //$mail->add_html_image($backgrnd, 'background.gif', 'image/gif'); $mail->add_html($html, $text); /*************************************** ** If not sending an html email, then ** this is used to set the plain text ** body of the email. ***************************************/ //$mail->set_body('ftfuygfyugyguilgulghlgjhlg'."\n\n\n".'jhlkgjguilguilguil ghjli'); /*************************************** ** This is used to add an attachment to ** the email. ***************************************/ //$mail->add_attachment($attachment, 'example.zip', 'application/octet-stream'); /*************************************** ** Set Character Set ***************************************/ $mail->set_charset('iso-8859-1', TRUE); /*************************************** ** Builds the message. ***************************************/ $mail->build_message(); /*************************************** ** Sends the message. $mail->build_message() ** is seperate to $mail->send so that the ** same email can be sent many times to ** differing recipients simply by putting ** $mail->send() in a loop. ***************************************/ $mail->send('TO NAME', 'edahnke@mediachex.com', 'FROM NAME', 'FROM ADDRESS', 'SUBJECT LINE'); ?>

« previous php.general (#36592) next »