|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51810 empty line added if $header is given to mail()
Submitted: 2010-05-13 16:58 UTC Modified: 2010-05-14 13:40 UTC
From: juergen dot vollmer at informatik-vollmer dot de Assigned: johannes (profile)
Status: Closed Package: Mail related
PHP Version: 5.3.2 OS: Linux / SuSE 11.2 and 10.2
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.
Block user comment
Status: Assign to:
Bug Type:
From: juergen dot vollmer at informatik-vollmer dot de
New email:
PHP Version: OS:


 [2010-05-13 16:58 UTC] juergen dot vollmer at informatik-vollmer dot de
If mail() is called with the $header argument, an empty line is inserted before the $header ĺine. Therefore the content of $header is not seen as valid mail header.

Test script:

$crlf = chr(13) . chr(10);

$to      = "";
$subject = "my subject";
$body1   = "my body -- with header";
$body2   = "my body -- no header";
$header  = "From:${crlf}".
           "X-Mailer: PHP/" . phpversion() . $crlf;

$res1 = mail ($to, $subject, $body1, $header);
$res2 = mail ($to, $subject, $body2);

printf ("mail res=${res1}; ${res2}\n");

Actual result:
If $header is given (see example above) the (shortened) mail text looks like:
---------------------------  from here
Return-Path: <....>
Received: ....
Subject: my sub
X-Mailer: PHP/5.3.1
Message-Id: <...>
From: ...
Message-Id: <...>
Date: ...
X-Length: 2014
X-UID: 252148

Message-Id: <...>
Date: ....
From: ....

my body -- with header1
---------------------- to here

Now After X-UID: there is an empty line, which should n ot be there (in my opinion).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-13 18:27 UTC]
-Status: Open +Status: Feedback
 [2010-05-13 18:27 UTC]
Please try using this snapshot:
For Windows:

 [2010-05-14 12:46 UTC] juergen dot vollmer at informatik-vollmer dot de
That version of php fixes the problem
 [2010-05-14 13:40 UTC]
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: johannes
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 19:01:25 2021 UTC