php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23507 extra newlines in mail header
Submitted: 2003-05-06 10:30 UTC Modified: 2003-05-07 15:38 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: matpoc at lenta dot ru Assigned:
Status: Closed Package: Mail related
PHP Version: 4.3.2RC2 OS: FreeBSD 4.7-RELEASE-p4
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: matpoc at lenta dot ru
New email:
PHP Version: OS:

 

 [2003-05-06 10:30 UTC] matpoc at lenta dot ru
add extra newlines in mail header. 

Example:

mail("site@domain.tld","Site new user",$id_user,"Content-Type: text/html; charset=koi8-r");

result (without some unnecessary headers):
---------------------------------------------------
Received: from www by mail.domain.tld with local (Exim 3.36 #1)
	id 19D0fH-000HcK-00
	for site@domain.tld; Tue, 06 May 2003 19:31:19 +0800
To: site@domain.tld

Subject: Site new user

Content-Type: text/html; charset=koi8-r

Message-Id: <E19D0fH-000HcK-00@mail.domain.tld>
From: World Wide Web Owner <www@domain.tld>
Date: Tue, 06 May 2003 19:31:19 +0800

NEWUSERNAME
---------------------------------------------------

PHP compiled with gd2, freetype, jpeg, png, zlib, mysql modules.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-06 17:34 UTC] nicos@php.net
Do you really think that it's a problem?

Anything in the RFC saying that it's bad?

 [2003-05-06 17:43 UTC] wez@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2003-05-06 23:03 UTC] matpoc at lenta dot ru
RFC2822 "Internet Message Format" ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt says:

A message consists of header fields (collectively called "the header
of the message") followed, optionally, by a body.  The header is a
sequence of lines of characters with special syntax as defined in
this standard. The body is simply a sequence of characters that
follows the header and is separated from the header by an empty line
(i.e., a line with nothing preceding the CRLF).

So, in my example all lines after "To: site@domain.tld" line interpreted as message body. Therefor mail programm can't see other headers and can't understand it's Subject, charset, etc.

BTW, mail function works correctly in PHP 4.3.1, and after upgrade to 4.3.2RC2 mail finctionality was broken. So, I downgraded to PHP 4.3.1.
 [2003-05-06 23:34 UTC] wez@php.net
We can read RFCs too... but what we really want is a short self-contained script that reproduces the problem (which is why we directed you to the how-to-report page).
We don't want an edited version of the script and the results, because we have no way to be sure that we are seing the same results as you.

 [2003-05-07 00:44 UTC] matpoc at lenta dot ru
The script is simple (I changed my real domain to domain.tld):

<? mail("site@domain.tld","Site new user","NEWUSERNAME","Content-Type:text/html; charset=koi8-r"); ?>

PHP 4.3.1 make this mail:
---------------------------------------------------
From - Wed May 07 13:10:22 2003
Return-path: <www@domain.tld>
Envelope-to: site@domain.tld
Delivery-date: Wed, 07 May 2003 13:10:14 +0800
Received: from www by mail.domain.tld with local (Exim 3.36 #1)
	id 19DHC2-0006UR-00
	for site@domain.tld; Wed, 07 May 2003 13:10:14 +0800
To: site@domain.tld
Subject: Site new user
Content-Type:text/html; charset=koi8-r
Message-Id: <E19DHC2-0006UR-00@mail.domain.tld>
From: World Wide Web Owner <www@domain.tld>
Date: Wed, 07 May 2003 13:10:14 +0800

NEWUSERNAME

.
---------------------------------------------------

PHP 4.3.2RC2
---------------------------------------------------
From - Wed May 07 13:12:33 2003
Return-path: <www@domain.tld>
Envelope-to: site@domain.tld
Delivery-date: Wed, 07 May 2003 13:12:12 +0800
Received: from www by mail.domain.tld with local (Exim 3.36 #1)
	id 19DHDw-0006X3-00
	for site@domain.tld; Wed, 07 May 2003 13:12:12 +0800
To: site@domain.tld

Subject: Site new user

Content-Type:text/html; charset=koi8-r

Message-Id: <E19DHDw-0006X3-00@mail.domain.tld>
From: World Wide Web Owner <www@domain.tld>
Date: Wed, 07 May 2003 13:12:12 +0800

NEWUSERNAME

.
---------------------------------------------------
 [2003-05-07 03:37 UTC] edink@php.net
Assuming that you put your 1 line script in file called test.php could you please post the result of the following command:

/path/to/cli/php -d sendmail_path=/bin/cat test.php | xxd

 [2003-05-07 15:38 UTC] edink@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 22:01:31 2024 UTC