ID: 40854 Updated by: [EMAIL PROTECTED] Reported By: mumu at seznam dot cz -Status: Open +Status: Assigned Bug Type: IMAP related Operating System: FreeBSD PHP Version: 5.2.1 -Assigned To: +Assigned To: iliaa
Previous Comments: ------------------------------------------------------------------------ [2007-03-19 14:14:54] mumu at seznam dot cz Description: ------------ The imap_mail_compose() function does not handle the last part of the body correctly. The MIME header etc. appears twice - once as expected and second (pluse "--" text) after the last boundary. Reproduce code: --------------- The same example as on http://cz.php.net/manual/en/function.imap-mail-compose.php <?php $envelope["from"]= "[EMAIL PROTECTED]"; $envelope["to"] = "[EMAIL PROTECTED]"; $envelope["cc"] = "[EMAIL PROTECTED]"; $part1["type"] = TYPEMULTIPART; $part1["subtype"] = "mixed"; $filename = "/tmp/imap.c.gz"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); $part2["type"] = TYPEAPPLICATION; $part2["encoding"] = ENCBINARY; $part2["subtype"] = "octet-stream"; $part2["description"] = basename($filename); $part2["contents.data"] = $contents; $part3["type"] = TYPETEXT; $part3["subtype"] = "plain"; $part3["description"] = "description3"; $part3["contents.data"] = "contents.data3\n\n\n\t"; $body[1] = $part1; $body[2] = $part2; $body[3] = $part3; echo nl2br(imap_mail_compose($envelope, $body)); exit; ?> Expected result: ---------------- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="0-1804289383-1174312409=:47393" --0-1804289383-1174312409=:47393 Content-Type: APPLICATION/octet-stream Content-Transfer-Encoding: BASE64 Content-Description: imap.c.gz --0-1804289383-1174312409=:47393 Content-Type: TEXT/plain; CHARSET=US-ASCII Content-Description: description3 contents.data3 ----0-1804289383-1174312409=:47393 Content-Type: TEXT/plain; CHARSET=US-ASCII Content-Description: description3 -- Actual result: -------------- Something like: From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="0-1804289383-1174312409=:47393" --0-1804289383-1174312409=:47393 Content-Type: APPLICATION/octet-stream Content-Transfer-Encoding: BASE64 Content-Description: imap.c.gz --0-1804289383-1174312409=:47393 Content-Type: TEXT/plain; CHARSET=US-ASCII Content-Description: description3 contents.data3 ----0-1804289383-1174312409=:47393 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40854&edit=1