php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22962 mail-function uses only \n to seperate fields To & Subject
Submitted: 2003-03-30 08:48 UTC Modified: 2003-05-11 13:53 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: uroeder at gmx dot net Assigned:
Status: Closed Package: Mail related
PHP Version: 4.3.1 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: uroeder at gmx dot net
New email:
PHP Version: OS:

 

 [2003-03-30 08:48 UTC] uroeder at gmx dot net
The php-Manual suggests "... You must use \r\n to seperate headers, ...", but when you take a look at ext/standard/mail.c the To- and Subject-field given as arguments to the php-mail-function are seperated by using ONLY newline (\n). Maybe sendmail corrects this mistake automatically, but I'm using postfix and when I try to send mail some of my additional headers (which are all correctly seperated by \r\n) appear in the message-body.
Fixing this bug is easy, just edit ext/standard/mail.c lines 199-204 (fprintf(sendmail, ...)) and replace \n with \r\n.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-01 00:28 UTC] pollita@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.

Fixed (partially) in CVS.

The \n characters surrounding the message body have been left as \n only while \n characters in headers have been expanded to \r\n.  This is because of tests with multiple MTAs showing inconsistent behavior which is best left as is.
 [2003-05-06 16:28 UTC] om at insign dot ch
Hi,
  
can it be that the bug you fixed last month
( http://bugs.php.net/bug.php?id=22962 ) broke something in
the mail() command ? 
   
We have a kind of CMS (www.icms.ch) with a mailclass which sends 
mails with attachments: with php 4.3.1 it works fine, with 4.3.2rc2
it "looks" fine too, but outlook users can't read the mail   
anymore: pretty wired... (no changes others than php version)

I'll make some more tries tomorrow, but maybe you will have
an idea before :)

Regards from Switzerland,
Olivier
 [2003-05-06 18:59 UTC] pollita@php.net
Pasting some headers (or entire message content) would be a big plus.  The fix applied here should not adversely affect Outlook, but it's worth some investigation.
 [2003-05-07 07:15 UTC] edink@php.net
This bugfix is wrong. \r\n is used in headers in SMTP communication which mail() uses on Windows. Since Unix version of mail() pipes output to mta direcly \r\n may confuse it and as we have seen from several reports it breaks mail() functionality.
 [2003-05-11 10:40 UTC] om at insign dot ch
pollita: I can't post any example yet, but I'm now sure there is a real problem: an "original" php-4.3.2rc2 is broken, while a php-4.3.2rc2 compiled with the mail.c from 4.3.1 is working fine. 

The used class to send the mails is an old version (1.3.4) of the HTML Mime mail by Richard Heyes (http://www.phpguru.org/mime.mail.html). We'll try if it works better with the current version, but in every case, there _is_ a problem with the current mail.c. 

regards,
Olivier
 [2003-05-11 13:53 UTC] pollita@php.net
What edink's last comment didn't mention is that I reverted mail() back to its original behavior.  No need to worry about comming up with examples.  4.3.2's final release will do just what you want.
 [2003-05-14 01:17 UTC] om at insign dot ch
Great, thanks & regards from Z?rich :-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 07:01:29 2024 UTC