php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10136 Function mail() does not work properly
Submitted: 2001-04-03 09:57 UTC Modified: 2002-06-02 11:13 UTC
From: arnaud at cenet dot fr Assigned:
Status: Closed Package: Mail related
PHP Version: 4.0.4pl1 OS: Win32 (2K and 9x) - IIS 5 & Apac
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arnaud at cenet dot fr
New email:
PHP Version: OS:

 

 [2001-04-03 09:57 UTC] arnaud at cenet dot fr
First, I tried making mail() function work() on a Win2k - IIS 5.0 server and on Win98SE - Apache 1.3.19 both with PHP 4.0.4pl1.

there are several things wrong (so far it wouldn't be me the problem ;-) ) :
- first :
mail ("Arnaud <arnaud@cenet.fr>","A subject here","A message body here",...);
(as mentioned in PHP manual), It won't work, i have a "Warning: Server error on blabla.php3:lineXX" but if the "To:" Field is replace by just an email adress : mail("arnaud@cenet.fr",....); this would work... So I can't send mails with the name of the recipients properly set (just their email adress)...
NB: Multiple "To:" Recipients works but only with email adresses

That's not the most important problem for me, the most important is Cc: and Bcc: won't work.
The manual mentions to add From: Cc: and Bcc: information, in the fourth parameters (the headers)... So I tried :
mail("arnaud@cenet.fr","A subject here","A (very nice !) body here","From: The Administrator <admin@cenet.fr>\nBcc: My Friend <myfriend@cenet.fr>\nCc: My Father <myfather@cenet.fr>");
it obviously doesn't work :-(( (that's why I'm writing you !!)
There are several things to say :
- The From: section of headers works well, nothing to say about it... No problem
- Seems the Bcc: part is just ignored, nothing happen, no mail is sent to Bcc: address
- For Cc:, when typed "cc:" (all lowercase) seems to be ignored but when typed "Cc:" => It looks like there is a memory leak or something like that both IIS and Apache return me a "emalloc() : unable to allocate -851230 bytes"... The number of unallocated bytes is not ever the same but this is the same error message...

Extra info :
- On both config, the mail server is a local mail server (FTGate 2.2.2.1)
- It seems that this bug is similar to #9858 and #9859 in the bug database

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-03 17:25 UTC] bbonev@php.net
i'd suggest one thing - try this (it will give more light if the problem is in your mailserver):

telnet localhost 25
helo there
mail from: your@address.com
rcpt to: dest@address.com
data
from: "your name" <ffgghjh@addresss.com>
to: "name 1" <adr1@adr.com>, "name 2" <adr2@adr.com>, etc@other.com
subject: some subject

some nice body
 [2001-04-04 03:20 UTC] arnaud at cenet dot fr
Seems to work but i need to put addresses between <> for mail from: and rcpt to: fields...
 [2001-04-05 06:27 UTC] arnaud at cenet dot fr
OK, I found the problem, folks !!

If you want to send messages in Cc: and Bcc: and personnalize to name of the To: recipients, I found a topic in newsgroup, you have to :
put all adresses (including To:, Cc: and Bcc: adress) in the $to field of mail function and then in the header, you put in to: bcc: and cc: the correct adresses... By this way, the mail function will properly put the adresses in the right fields, example :
$to = "arnaud@cenet.fr, admin@cenet.fr, test@cenet.fr"
$from = "Test PHP <testphp@noreply.cenet.fr>\n";
$headers = "To: Nono <arnaud@cenet.fr>\n";
$headers .= "cc: Admin CEnet <admin@cenet.fr>\n";
$headers .= "Bcc: Hidden test <test@cenet.fr>";

mail ($to,"my subject","my (nice !) body","From: $from".$headers);

It works...

But now the real bug (yes it is !!) is when typing "Cc:" instead of "cc:" => It looks like there's a emalloc error allocating -875642131 bytes (the number is not ever the same)... Think I'll open a new bug entry !!! 
 [2001-06-22 18:42 UTC] hholzgra@php.net
windows mail code *badly* needs a rewrite
 [2002-06-02 11:13 UTC] mfischer@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version 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.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC