php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33976 mail() overrides the provided header
Submitted: 2005-08-03 14:05 UTC Modified: 2005-08-03 16:22 UTC
From: dominik dot blystak at pro-open dot de Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.11 OS: Mandrake Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dominik dot blystak at pro-open dot de
New email:
PHP Version: OS:

 

 [2005-08-03 14:05 UTC] dominik dot blystak at pro-open dot de
Description:
------------
In php 4.3.10 and 4.3.4 of Mandrake Linux I encountered the following behaviour. The mail() function sets a second mime-header with  Content-Type: text/plain; charset=UTF-8 and Content-Transfer-Encoding: BASE64 regardless of an already provided header. I could verify this problem with example code of the mail() documentation.

Reproduce code:
---------------
<?php
        $to  = "dominik.blystak@pro-open.de"; // beachten Sie das Komma
        $subject = "Geburtstags-Erinnerung f?r August";
        $message = '
        <html>
        <head>
         <title>Geburtstags-Erinnerung f?r August</title>
         </head>
         <body>
         <p>Hier sind die Geburtstage im August!</p>
                     </body>
                     </html>
                     ';
        $headers  = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
        $headers .= "Content-Transfer-Encoding: quoted-printable\r\n";
        mail($to, $subject, $message, $headers);
?>


Expected result:
----------------
There is just one mime-header (reduced to relevant parts):

To: my@mail.com
Subject: Geburtstags-Erinnerung f?r August
MIME-Version: 1.0
Content-type: text/html;
  charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Message-Id: <20050803115921.B21BF9DCE6@server.com>
Date: Wed,  3 Aug 2005 13:59:21 +0200 (CEST)
From: apache@server.com (system user for apache)
X-Length: 1114
X-KMail-EncryptionState:  
X-KMail-SignatureState:  
X-KMail-MDN-Sent:  
X-UID: 1135
Status: RO
X-Status: OC

	<html>
	<head>
	 <title>Geburtstags-Erinnerung f?r August</title>
	 </head>
	 <body>
	 <p>Hier sind die Geburtstage im August!</p>
		     </body>
		     </html>

Actual result:
--------------
There are two mime-headers (reduced to relevant parts):

To: my@mail.com
Subject: Geburtstags-Erinnerung =?UTF-8?B?ZsO8ciBBdWd1?=
 =?UTF-8?B?c3Q=?=
MIME-Version: 1.0
Content-type: text/html;
  charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64
Message-Id: <20050803115702.836366BC021@server.com>
Date: Wed,  3 Aug 2005 13:57:02 +0200 (CEST)
From: apache@server.com (system user for apache)
X-UID: 39490
X-Length: 1211
Status: R
X-Status: NC
X-KMail-EncryptionState:  
X-KMail-SignatureState:  
X-KMail-MDN-Sent:  

Cgk8aHRtbD4KCTxoZWFkPgoJIDx0aXRsZT5HZWJ1cnRzdGFncy1FcmlubmVydW5nIGbDvHIgQXVn
dXN0PC90aXRsZT4KCSA8L2hlYWQ+CgkgPGJvZHk+CgkgPHA+SGllciBzaW5kIGRpZSBHZWJ1cnRz
dGFnZSBpbSBBdWd1c3QhPC9wPgoJCSAgICAgPC9ib2R5PgoJCSAgICAgPC9odG1sPgoJCSAgICAg


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-03 16:21 UTC] dominik dot blystak at pro-open dot de
The cause for this problem is mbstring which overloads the mail() function, thus adding another header with utf-8 and base64. 

Solution:
set mbstring.func_overload = 6 in php.ini, this deactivates overloading of the mail() function.
 [2005-08-03 16:22 UTC] dominik dot blystak at pro-open dot de
Anyways mbstring should remove the old header
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Sep 26 22:05:54 2022 UTC