Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #8386 HTML body not correctly encoded if attachments present
Submitted: 2006-08-08 11:01 UTC
From: lucabert at lucabert dot de Assigned: cipri
Status: Closed Package: Mail_Mime (version 1.3.1)
PHP Version: 4.3.5 OS: Linux RedHat 9
Roadmaps: 1.4.0, 1.4.0a1    
Subscription  


 [2006-08-08 11:01 UTC] lucabert at lucabert dot de (Luca Bertoncello)
Description: ------------ If an E-Mail has attachments, it seems not to encode the HTML part. Many Mailer have problem to display the message. Test script: --------------- <? include('Mail.php'); include('Mail/mime.php'); $mime = new Mail_mime("\n"); $mime->setTXTBody('Das ist ein Test'); $mime->setHTMLBody('<HTML><BODY><H1>Das ist ein TEST</H1></BODY></HTML>'); $mime->addAttachment('/tmp/test.gz', 'application/x-gzip', 'test.gz'); $hdrs = array( 'From' => 'Luca Bertoncello <lucabert@server.de>', 'To' => 'lucabert@server.de', 'Subject' => 'Ein kleines Test', 'Message-Id' => '<'.date('YmdHis').'.'.posix_getpid().'@localhost>', 'Date' => date('r') ); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mail =& Mail::factory('smtp', array('host' => 'localhost', 'auth' => 'CRAM-MD5', 'username' => '<my Username>', 'password' => '<my Password>', 'localhost' => 'server.de')); $ret = $mail->send('lucabert@server.de', $hdrs, $body); ?> Expected result: ---------------- This is a normal HTML E-Mail with an Attachment: Subject: HTML mit 2 Attachments From: Luca Bertoncello <lucabert@server.de> To: lucabert@server.de Content-Type: multipart/mixed; boundary="=-FssUx3EEijD6zZ/ed9KI" Message-Id: <1154341815.5647.1.camel@lucabert> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 31 Jul 2006 12:30:15 +0200 --=-FssUx3EEijD6zZ/ed9KI Content-Type: multipart/alternative; boundary="=-X5H4pZuJcQ+po6ZfSGQ3" --=-X5H4pZuJcQ+po6ZfSGQ3 Content-Type: text/plain Content-Transfer-Encoding: 7bit Und HTML dazu --=-X5H4pZuJcQ+po6ZfSGQ3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8"> <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.10"> </HEAD> <BODY> Und <FONT COLOR="#3366ff"><B><I><U><S>HTML</S></U></I></B></FONT> dazu </BODY> </HTML> --=-X5H4pZuJcQ+po6ZfSGQ3-- --=-FssUx3EEijD6zZ/ed9KI Content-Disposition: attachment; filename=test.gz Content-Type: application/x-gzip; name=test.gz Content-Transfer-Encoding: base64 H4sICHLbzUQAA3BpcHBvAAsoyi9L5AIAtFpUkQYAAAA= --=-FssUx3EEijD6zZ/ed9KI-- Actual result: -------------- And this is what I get with the script: MIME-Version: 1.0 From: Luca Bertoncello <lucabert@server.de> To: lucabert@server.de Subject: Ein kleines Test Message-Id: <20060808123727.19652@localhost> Date: Tue, 8 Aug 2006 12:37:27 +0200 Content-Type: multipart/mixed; boundary="=_ecadccd86e007f0fabc3b902aa72fbeb" --=_ecadccd86e007f0fabc3b902aa72fbeb Content-Type: multipart/alternative; boundary="=_e5f0bb1e2fb2b32f9a165a2837a330cf" --=_e5f0bb1e2fb2b32f9a165a2837a330cf Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Das ist ein Test --=_e5f0bb1e2fb2b32f9a165a2837a330cf Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable <HTML><BODY><H1>Das ist ein TEST</H1></BODY></HTML> --=_e5f0bb1e2fb2b32f9a165a2837a330cf-- --=_ecadccd86e007f0fabc3b902aa72fbeb Content-Type: application/x-gzip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.gz" H4sICHLbzUQAA3BpcHBvAAsoyi9L5AIAtFpUkQYAAAA= --=_ecadccd86e007f0fabc3b902aa72fbeb-- The Problem is that, betwenn the 2 boundaries after HTML, there is NO newline!

Comments

 [2006-10-18 20:52 UTC] cipri (Cipriano Groenendal)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. An extra MAIL_MIMEPART_CRLF is now added after ever set of parts.
 [2007-05-05 15:08 UTC] cipri (Cipriano Groenendal)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Mail_Mime Fixed in 1.4.0