ID: 30766 User updated by: aflem26 at hotmail dot com Reported By: aflem26 at hotmail dot com -Status: Open +Status: Closed Bug Type: Mail related Operating System: RHEL 3.0 PHP Version: 4.3.9 New Comment:
In fact, this issue is related to an unscrupulous setting of mbstring.func_overload in php.ini in the RHEL 3.0 AS RPM for php. This causes an mb_mail function to be called, which indeed encodes the body and adds the appropriate headers, potentially in conflict with use supplied headers. This causes many mail programs to fail, ie. Iloha Mail or Squirrel Mail Previous Comments: ------------------------------------------------------------------------ [2004-11-13 11:13:24] aflem26 at hotmail dot com I have isolated the problem, and it is not with sendmail. Please note how I tested this: $php -d sendmail_path=/bin/cat test.php To: [EMAIL PROTECTED] Subject: subject Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 Ym9keQ== Kindest Regards ------------------------------------------------------------------------ [2004-11-12 08:52:21] [EMAIL PROTECTED] PHP does not any headers or encodes the body at all, we simply pipe the data through the sendmail binary on your system so if anything changes it is there where that happens. ------------------------------------------------------------------------ [2004-11-12 01:44:31] aflem26 at hotmail dot com Description: ------------ system: vanilla rhel 3.0 original php version: 4.3.2 manually compiled and installed 4.3.9, but the bug persists I have noticed that simple mail() calls result in php adding erroneous headers in addition to and in conflict with those that I supply. In particular, the erroneous headers are: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 and php encoding the body into base 64, which shouldn't happen: "body" gets encoded as Ym9keQ== *please*, if this is to be expected, point me to some documentation, or some explanation. All my web based mail tools are broken due to the additional header, and mail I send through them comes out all garbled, because the mail script encodes the message, and then It gets encoded *again*. please. Thanks so much. my config line is as follows (long!): ./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i386-redhat-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-dom=/usr --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-regex=system --with-xml --with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --without-oci8 --with-pear=/usr/share/pear --with-kerberos=/usr/kerberos --with-ldap=shared --with-mysql=shared,/usr --with-pgsql=shared --with-unixODBC=shared --enable-memory-limit --enable-bcmath --enable-shmop --enable-versioning --enable-calendar --enable-dbx --enable-dio --enable-mcal --with-apxs2filter=/usr/sbin/apxs Reproduce code: --------------- $more test.php <? $header = "Content-Type: text/plain; charset=us-ascii"; mail('[EMAIL PROTECTED]', 'subject', 'body', $header); ?> Expected result: ---------------- Here's What I would Expect: $php -d sendmail_path=/bin/cat test.php To: [EMAIL PROTECTED] Subject: subject Content-Type: text/plain; charset=us-ascii body Actual result: -------------- Here's what I get. Please note the erroneous and conflicting Content-Type header, and the un-invited content-transfer encoding that has been applied: $php -d sendmail_path=/bin/cat test.php To: [EMAIL PROTECTED] Subject: subject Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: BASE64 Ym9keQ== Here's the same thing, piped through xdd: $php -d sendmail_path=/bin/cat test.php | xxd 0000000: 546f 3a20 6a6f 6540 7465 7374 2e63 6f6d To: [EMAIL PROTECTED] 0000010: 0a53 7562 6a65 6374 3a20 7375 626a 6563 .Subject: subjec 0000020: 740a 436f 6e74 656e 742d 5479 7065 3a20 t.Content-Type: 0000030: 7465 7874 2f70 6c61 696e 3b20 6368 6172 text/plain; char 0000040: 7365 743d 7573 2d61 7363 6969 0a4d 696d set=us-ascii.Mim 0000050: 652d 5665 7273 696f 6e3a 2031 2e30 0a43 e-Version: 1.0.C 0000060: 6f6e 7465 6e74 2d54 7970 653a 2074 6578 ontent-Type: tex 0000070: 742f 706c 6169 6e3b 2063 6861 7273 6574 t/plain; charset 0000080: 3d55 5446 2d38 0a43 6f6e 7465 6e74 2d54 =UTF-8.Content-T 0000090: 7261 6e73 6665 722d 456e 636f 6469 6e67 ransfer-Encoding 00000a0: 3a20 4241 5345 3634 0a0a 596d 396b 6551 : BASE64..Ym9keQ 00000b0: 3d3d 0a ==. $ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30766&edit=1