|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-10 07:43 UTC] carsten_sttgt at gmx dot de
[2009-05-10 16:39 UTC] jani@php.net
[2009-05-10 16:40 UTC] jani@php.net
[2009-05-11 07:21 UTC] carsten_sttgt at gmx dot de
[2009-05-11 09:55 UTC] jani@php.net
[2009-05-14 07:14 UTC] carsten_sttgt at gmx dot de
[2020-10-12 14:06 UTC] cmb@php.net
-Summary: wrong behaviour and crash with
imap_mail_compose()
+Summary: wrong behaviour of imap_mail_compose()
-Status: Open
+Status: Verified
-PHP Version: 5.*, 6CVS (2009-05-09)
+PHP Version: 7.3
[2020-10-12 14:06 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |
Description: ------------ Hello, from my understanding, and if I read RFC2045-sec6.2, imap_mail_compose() is working in a wrong way. From RFC2045: - With "binary", "8bit" and "7bit" no transforming is done. - With "quoted-printable" and "base64", the data is transformed to 7bit, according to the selected encoding type. The behavior from imap_mail_compose(): - with ENC7BIT no Content-Transfer-Encoding header is set (ok, that's the same. maybe correct) - with ENC8BIT, the Content-Transfer-Encoding changes to "quoted-printable" and the data is transfomed (wrong) - with ENCBINARY, the Content-Transfer-Encoding changes to "base64" and the data is transfomed (wrong) - with ENCBASE64, the Content-Transfer-Encoding is "base64" and the data is transfomed (correct) - with ENCQUOTEDPRINTABLE, the Content-Transfer-Encoding is "quoted-printable" and the data is transfomed (correct) - ENCOTHER is imho not really useful (especially if I can't set the name (foo) in x-foo). Then I've tried to set the value for the Content-Transfer-Encoding header on my own: - with "binary", no Content-Transfer-Encoding header is set - with "8bit" (or "7bit"), I have a segmentation fault (PHP crashes). Regards, Carsten Reproduce code: --------------- <?php $data8bit = 'a german umlaut ?.'; $data7bit = 'just a text in us-ascii.'; $body = array(); $i = 0; $body[++$i] = array( 'type' => TYPEMULTIPART, 'subtype' => 'mixed' ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'us-ascii', 'encoding' => ENC7BIT, 'contents.data' => $data7bit ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'iso-8859-1', 'encoding' => ENC8BIT, 'contents.data' => $data8bit ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'iso-8859-1', 'encoding' => ENCBINARY, 'contents.data' => $data8bit ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'iso-8859-1', 'encoding' => ENCBASE64, 'contents.data' => $data8bit ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'iso-8859-1', 'encoding' => ENCQUOTEDPRINTABLE , 'contents.data' => $data8bit ); $body[++$i] = array( 'type' => TYPETEXT, 'charset' => 'iso-8859-1', 'encoding' => 'binary', 'contents.data' => $data8bit ); //$body[++$i] = array( // 'type' => TYPETEXT, // 'charset' => 'iso-8859-1', // 'encoding' => '8bit' , // 'contents.data' => $data8bit //); echo imap_mail_compose(array(), $body); ?> Expected result: ---------------- MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="62-22384-1241869364=:9856" --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Transfer-Encoding: 7BIT just a text in us-ascii. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: 8BIT a german umlaut ?. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: BINARY a german umlaut ?. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: BASE64 YSBnZXJtYW4gdW1sYXV0IOQu --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE a german umlaut =E4. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: binary a german umlaut ?. --62-22384-1241869364=:9856-- Actual result: -------------- MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="62-22384-1241869364=:9856" --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=us-ascii just a text in us-ascii. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE a german umlaut =E4. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: BASE64 YSBnZXJtYW4gdW1sYXV0IOQu --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: BASE64 a german umlaut ?. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE a german umlaut ?. --62-22384-1241869364=:9856 Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1 a german umlaut ?. --62-22384-1241869364=:9856--