php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25254 Using /r/n in mailheaders causes mailbody to become currupt
Submitted: 2003-08-26 11:59 UTC Modified: 2003-11-04 13:47 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: ts at dreamcoder dot dk Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.3 OS: 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: ts at dreamcoder dot dk
New email:
PHP Version: OS:

 

 [2003-08-26 11:59 UTC] ts at dreamcoder dot dk
Description:
------------
When running the attached code, the mail headers will not be sent correctly

This results in the mailheaders becomming corrupt and send two linebreaks, thus dumping the remaining headers to the mail body. Notice how two Message-Id's and Date headers are sent with the mail

The attached code worked fine in PHP 4.3.2. But also works when using \n instead of \r\n

Reproduce code:
---------------
<?php
    echo mail("example@example.com", "Test Mail", "Hello",
         "From: John <test@example.com>\r\n"
        ."X-Engine: This\r\n"
        ."X-Mailer: PHP/" . phpversion());
?>

Expected result:
----------------
Headers:

From: John <test@example.com>
X-Engine: This
X-Mailer: PHP/4.3.3
Message-Id: <20030826164802.3A2B314152@mail.example.com>
Date: Tue, 26 Aug 2003 18:48:02 +0200 (CEST)

Hello

Actual result:
--------------
Headers:

From: John <test@example.com>
X-Engine: This
Message-ID: <1061916489.17277@example.com>
Date: Tue, 26 Aug 2003 18:48:09 +0200

X-Mailer: PHP/4.3.3
Message-Id: <20030826164802.3A2B314152@mail.example.com>
Date: Tue, 26 Aug 2003 18:48:02 +0200 (CEST)

Hello

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-26 23:50 UTC] sniper@php.net
Either using \r\n or just \n works just fine for me.
Not PHP bug.

 [2003-08-27 01:13 UTC] ts at dreamcoder dot dk
It's still an issue in terms of BC.

As I mentioned, it worked fine in 4.3.2
 [2003-10-08 13:52 UTC] ts at dreamcoder dot dk
I just tested this with 4.3.4RC2-dev (as requested), it's exactly the same problem

I also tried sending mail using PHPMailer (the class).
Sending mails directly to the SMTP with \r\n works just fine

However when using PHP's mail() and \r\n, it fails to send correctly, as described in the original bug

I have PostFix 2.0.16 installed - if that has any relevance
I cannot rule out this could be a bug in Postfix, but I doubt it
 [2003-10-09 06:46 UTC] sniper@php.net
Works fine with sendmail.

 [2003-11-04 13:47 UTC] ts at dreamcoder dot dk
This bug was fixed in 4.3.4, works for me now...

Might also be because I switched to redhat, who knows
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Oct 02 10:05:51 2022 UTC