|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2003-02-20 00:07 UTC] mark at virtualcreations dot com dot au
 This just started happening with 4.3.0.  Before that it was all fine.  The problem only exists on Win32 - it works perfectly on Linux.
Using the example from the manual, this works fine:
   mail("xx@yy.com", "My Subject", "Line 1");
But this returns FALSE and the message is not sent:
   mail("xx@yy.com, aa@bb.com", "My Subject", "Line 1");
However, THIS is fine (note the missing space):
   mail("xx@yy.com,aa@bb.com", "My Subject", "Line 1");
Also, I have yet to figure out a way to send a message where the recipient's NAME is also specified.  For example, this fails:
   mail("Fred <xx@yy.com>", "My Subject", "Line 1");
Finally, when I use a BCC option, it is also dependent upon the placement of a space.  For example, if I include a line that reads:
   $headers .= "Bcc:xx@yy.com\n";
it works as expected, but:
   $headers .= "Bcc: xx@yy.com\n";
fails.  It doesn't make any difference if a "\r\n" is added to the end of the line.
I repeat, all the problems above are NOT problems in Linux.
Mark.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 17:00:02 2025 UTC | 
Thanks for the suggestion. I put the error reporting code in, and now have more information to share: When I tried: mail("aa@bb.com, cc@dd.com", "My Subject", "Line 1") I got the response: Warning: mail() [function.mail]: SMTP server response: 501 unacceptable characters in local-part in index.php on line 5 I think the "unacceptable characters" refers to the space after the comma and before the "cc@dd.com". Then I tried: mail("Fred <aa@bb.com>", "My Subject", "Line 1") and got the response: Warning: mail() [function.mail]: SMTP server response: 501 illegal address syntax in index.php on line 5 But this same line of code works fine in Linux, and used to work fine in Win32 4.2.3 Mark.Well, the SMTP server is the one I use through my ISP (mail-bpa.bigpond.com). But because of your comments, I tried another SMTP server (mail.virtualcreations.com.au), and it worked better, but still not perfectly. Sending to two recipients (separated by commas) worked fine this time, but sending to "Mark <mvirtue@zip.com.au>" had a problem. The SMTP server sent the message, but it bounced, with the following reason: Remote host said: 550 5.1.1 <"Mark <mvirtue"@zip.com.au>... User unknown (but that is a perfectly valid address, of course). Then I tried a THIRD SMTP server (smtp.zipworld.com.au), and everything worked perfectly. So, clearly all SMTP servers are different, but I would hope that the Win32 version of the mail() sending function would work with as many as possible of them. I reiterate what I said before: Before version 4.3.0, this worked perfectly, and I've never had any problems with the Linux version. Mark.