php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17753 mail() doesn't send body when headers are set (4th parameter)
Submitted: 2002-06-13 16:16 UTC Modified: 2002-06-13 19:20 UTC
From: WPinegar at healthtech dot net Assigned:
Status: Closed Package: Mail related
PHP Version: 4.0CVS-2002-06-13 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2002-06-13 16:16 UTC] WPinegar at healthtech dot net
I just downloaded the latest Win32 build of PHP 4.3.0-dev from http://snaps.php.net/win32 and noticed that the following code segment does not work correctly:

mail("testuser@mydomain.com", "Test E-Mail", $PHP_AUTH_USER." has send a test e-mail message.", "From: webmaster@mydomain.com\nReply-To: $replyto\nX-Mailer: PHP/".phpversion());

In the current development version of PHP 4.3.0-dev the e-mail is sent but there is no body.  When I revise my code and omit the headers from the 4th parameter, everything works fine and the body of the e-mail message is sent correctly.

mail("testuser@mydomain.com", "Test E-Mail", $PHP_AUTH_USER." has send a test e-mail message.");

Please correct this problem.  Thanks!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-13 16:29 UTC] sesser@php.net
Please read the documentation:

Note: You must use \r\n to seperate headers, although some Unix mail transfer agents may work with just a single newline (\n). 


 [2002-06-13 16:35 UTC] WPinegar at healthtech dot net
The code with "\n" worked perfectly in PHP 4.3.0-dev dated 5/18/2002 and PHP 4.2.0.

The following code also exhibits the same problem in today's CVS build of PHP 4.3.0-dev:

mail("testuser@mydomain.com", "Test E-Mail", $PHP_AUTH_USER." has sent a
test e-mail message.", "From: webmaster@mydomain.com");

Notice that there are no \n or \r\n in this code since there is only one header being passed.  With this code the body is not transmitted.  Omitting the header again corrects the problem.

This is definately a new problem in the CVS build...
 [2002-06-13 17:49 UTC] sesser@php.net
The problem should be fixed in cvs now, please test with
latest Win32 build when the next one is created.


 [2002-06-13 19:20 UTC] WPinegar at healthtech dot net
Yes, the problem is now fixed.  Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC