php.net |  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
 [2010-05-13 16:58 UTC] juergen dot vollmer at informatik-vollmer dot de
Description:
------------
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:
---------------
<?php

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

$to      = "me@example.com";
$subject = "my subject";
$body1   = "my body -- with header";
$body2   = "my body -- no header";
$header  = "From: you@example.com${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: ....
To: me@example.com
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).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-13 18:27 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2010-05-13 18:27 UTC] kalle@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-05-14 12:46 UTC] juergen dot vollmer at informatik-vollmer dot de
That version of php fixes the problem
Thanks
Jürgen
 [2010-05-14 13:40 UTC] johannes@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: johannes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC