|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26218 mail() sends extra "RCPT TO: <>" to smtp host
Submitted: 2003-11-12 09:36 UTC Modified: 2003-11-12 20:43 UTC
From: bzheng at us dot nomura dot com Assigned:
Status: Not a bug Package: Network related
PHP Version: 4.3.3 OS: W2k server/IIS 5/PHP in CGI mode
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bzheng at us dot nomura dot com
New email:
PHP Version: OS:


 [2003-11-12 09:36 UTC] bzheng at us dot nomura dot com
calling mail() function causes PHP to send out an extra "RCPT TO: <>" command to the SMTP host.

Packet sniffer shows:
S:250 2.1.0 <> Sender OK
S:250 2.1.5 <> Recipient OK
S:553 5.0.0 <> User address required

related entries in php.ini
[mail function]
; For Win32 only.
; For Win32 only.
sendmail_from =

The weird thing is, the same code works on another machine that has exactly the same php.ini and php software as the machine having problems.

Reproduce code:
$result = mail( $t_recipient, "test", "test msg");

where $t_recipient is a valid SMTP email address.

Expected result:
$result == true;

Actual result:
$result == false;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-12 09:49 UTC] bzheng at us dot nomura dot com
just to clarify.
The code is:
$result = mail( "", "sub", "msg");
 [2003-11-12 15:24 UTC] bzheng at us dot nomura dot com
tried and got the same result, now failing on both machines
 [2003-11-12 18:24 UTC]
Unable to replicate with PHP4-LATEST.

Is it possible your To: address has a coma at the end?  The way the Win32 sendmail code is written a "blank" recipient will be sent as just RCPT TO:<>.

Issue a var_dump( $t_recipient); prior to sending the mail to be certain it doesn't have a coma at the end.

Also, if you include headers with blank Cc: or Bcc: lines they will also exhibit this behavior.

 [2003-11-12 19:16 UTC] bzheng at us dot nomura dot com
My mistake.
There is a line "BCC:\n" in the header.
I must have done something wrong in the testing.
My apologies, for wasting your time.
 [2003-11-12 20:43 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

User error.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 23:05:52 2022 UTC