php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5113 Mail() function doesn't accept multiple recipients.
Submitted: 2000-06-19 00:09 UTC Modified: 2000-07-12 12:49 UTC
From: bjarne dot ingelsson at enator dot se Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Release Candidate 2 OS: Win2000
Private report: No CVE-ID: None
 [2000-06-19 00:09 UTC] bjarne dot ingelsson at enator dot se
PHP Version 4.0.0.

When sending mail to more than one recipient (comma separated) all recipients are sent,comma separated, in just one SMTP: "RCPT TO" message.
The mailserver responds with "553 Invalid Address Syntax" and the mail of course fails.

There should be only one recipient in a RCPT TO message.
So when sending to several, the correct way of doing this should be to send several RCPT TO messages with one recipient in each.

Example:
$To = "someone@thecompany.com,anotherone@thecompany.com";
mail($To,$Subject,$Msg,$Headers);

The SMTP will look like this:
RCPT TO: someone@thecompany.com,anotherone@thecompany.com

and should look like this:
RCPT TO: someone@thecompany.com
RCTP TO: anotherone@thecompany.com


The problem doesn't exist in PHP3.0.16.
/Bjarne



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-20 09:10 UTC] stas at cvs dot php dot net
See also #5136
 [2000-06-28 12:22 UTC] hholzgra at cvs dot php dot net
fixed in latest cvs
 [2000-07-04 23:12 UTC] hholzgra at cvs dot php dot net
the "fix" was rejected due to compilation problems
as my win system broke down i won't be able to
look at it until i get myself a new machine 
 [2000-07-12 12:48 UTC] jah at cvs dot php dot net
Fixed in cvs.
 [2000-07-12 12:49 UTC] jah at cvs dot php dot net
... and close.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 09:00:01 2026 UTC