php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40095 Multiple headers bug (v. 4.4.3)
Submitted: 2007-01-10 19:06 UTC Modified: 2007-01-10 21:24 UTC
From: indrek dot kriisa at gmail dot com Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.4.4 OS: Linux
Private report: No CVE-ID: None
 [2007-01-10 19:06 UTC] indrek dot kriisa at gmail dot com
Description:
------------
If I send mail with >1 custom header it will be not delivered or is with corrupted header (extra \r\n after last header).

If only 1 header line or no header - everything works
mail function gives no error

No difference when using "\n" or "\r\n"

Reproduce code:
---------------
$customheaders = 'X-Priority: 1 (Highest)'. "\r\n";
$customheaders .= 'X-MSMail-Priority: Highest'. "\r\n";

send_mail($to, $subject, $message, $customheaders);

Mail don't deliver:
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1;
Content-Transfer-Encoding: 8bit
X-Priority: 1 (Highest)
X-MSMail-Priority: Highest

Mail delivers:
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1;
Content-Transfer-Encoding: 8bit
X-MSMail-Priority: Highest

Expected result:
----------------
delivered email with added headers

Actual result:
--------------
extra linebreak (\r\n) between custom headers or mail is not delivered

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-10 19:08 UTC] indrek dot kriisa at gmail dot com
function send_mail($to, $subject, $message, $customheaders = '')
{
  $headers =
   	"MIME-Version: 1.0\r\n".
  	"Content-Type: text/html; charset=ISO-8859-1;\r\n".
  	"Content-Transfer-Encoding: 8bit\r\n".
  	$customheaders;

  return mail($to, $subject, $message, $headers);
}
 [2007-01-10 21:24 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC