Edit report at http://bugs.php.net/bug.php?id=51810&edit=1
ID: 51810 Updated by: ka...@php.net Reported by: juergen dot vollmer at informatik-vollmer dot de Summary: empty line added if $header is given to mail() -Status: Open +Status: Feedback Type: Bug Package: Mail related Operating System: Linux / SuSE 11.2 and 10.2 PHP Version: 5.3.2 New Comment: Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2010-05-13 16:58:13] 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 = "m...@example.com"; $subject = "my subject"; $body1 = "my body -- with header"; $body2 = "my body -- no header"; $header = "From: y...@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: m...@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). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51810&edit=1