php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17801 $header can only contain header data, multilpe newlines are ignored
Submitted: 2002-06-17 10:52 UTC Modified: 2002-06-19 05:30 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: gabinunde at yahoo dot de Assigned:
Status: Closed Package: Mail related
PHP Version: CVS OS: W98, NT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gabinunde at yahoo dot de
New email:
PHP Version: OS:

 

 [2002-06-17 10:52 UTC] gabinunde at yahoo dot de
On W98 and NT (Apache 2.0.35, PHP(as CGI) 4.1.1 and 4.2.1 tested) there is a problem sending multipart-mails:

mail($to,$subject,"",$header);

$header has been created like at http://phpwizard.net/resources/phpMisc/scripts/pretty/mail.php3 

Until the lenght of $header is <= 4012 byte everything is working fine. Obove that limit PHP.EXE crashes (drwtsn32.log) and Apache reports: "Premature end of script headers...".

Thanks Gabi

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-17 11:06 UTC] edink@php.net
Several mail() problems have been fixed in the latest CVS version of PHP. Could you please try the latest non stable snapshot from http://snaps.php.net/win32/
 [2002-06-18 06:38 UTC] gabinunde at yahoo dot de
First I tryed "php4-win32-STABLE-latest.zip" with PHP 4.2.2 as CGI and as module, but the same error accured with mail().

After I tryed "php4-win32-latest.zip" with PHP 4.3.0:
-Apache works with this version only as module, not as CGI.
-Now I can send mails with $header>4012 Byte, but the plain text of the message-body as well as the attachment are received as they were headers!!!!!!!! In the source-text of the received mail message and attachment are shown in bold like all the headers (From, To, Content-Type ect...). So one can't read the message and the attachment has 0 byte.
I could send an example of such a mail.

Gabi
 [2002-06-18 07:01 UTC] mfischer@php.net
Please send a script, which tries to send mail with the mail() function and produces failure output directly to me mfischer@php.net as I'm likely the one who fucked this up, thx.
 [2002-06-18 13:15 UTC] mfischer@php.net
Now that you sent me your script, I reflected the problem in the summary. The change was requested to many MTA problems which don' deal well with not-well-formed $headers.

So the current (CVS HEAD) behaviour is: Make sure whatever it is (\r, \n or \r\n) it's always \r\n (which IS required for sending over SMTP which is the case for win32) and also removing multiple \r\n occurences because they would break the header. You seem to have been used this behaviour (which isn't documented).

This can be fixed in user-space by crafting the $header carefully i.e. know where to stop and putting the rest in the $body.

I can't say anything about the BC impact here (I haven't got much feedback since the rewrite, but I think I should be happy what I got), but it seems it shouldn't be ignored.

I'm soon at the point were I'ld say I revert every change to mail() and create win32_mail_rfc_compliant() .. ;)
 [2002-06-19 05:30 UTC] gabinunde at yahoo dot de
On win32 never put message and/or attachments in the mail-header!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 17:01:30 2024 UTC