|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23798 Space not trimmed in Bcc and Cc parsing
Submitted: 2003-05-25 05:42 UTC Modified: 2003-07-23 11:10 UTC
Avg. Score:4.6 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: guidance at g dot yi dot org Assigned:
Status: Closed Package: Mail related
PHP Version: 4.3.2RC4 OS: Windows 2000 pro
Private report: No CVE-ID:
 [2003-05-25 05:42 UTC] guidance at g dot yi dot org
When using blank "To", and only Cc or Bcc to send an email, like below:

mail("", "the subject", 'message body',
     "From: webmaster@$SERVER_NAME\r\n"
    ."Reply-To: webmaster@$SERVER_NAME\r\n"
    ."X-Mailer: PHP/" . phpversion());

the receiver mail server will complain user unknown error, if check the raw received mail, will like this:

X-Envelope-To: <>

Notice there's an extra space in X-Envelope-To header!
Anyhow, if "To" is not blank, the received X-Envelope-To is correct.
If don't leave space after the colon of Bcc and Cc, the problem could temporarily resolved.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-25 07:11 UTC] guidance at g dot yi dot org
Some mail servers don't accept blank To, so this problem can't appear. I'm just using Phorum and Mercury/32 mail server, then found this problem.
X-Envelope-To header also depends on the mail server. May not be created at all or other similar header.
 [2003-06-25 13:02 UTC] jharrell at dlc4me dot com
I'm using a To: address in the mail() and a list of inner company emails under the Bcc: header... but I still get the SMTP Unknown user error... this error was not here in 4.2.3... but I can confirm that 4.3.2 does have problems with the Bcc and Cc headers... For now I guess I will send individual emails out. :(
 [2003-07-06 23:40 UTC] webmaster at e-xoops dot com
Just spent 2 days on same problem under php 4.3.1 trying to send bcc & cc headers (i know they worked before).

This works:,

This doesn't:

All other header fields seem to work ok as usual with the space after the :, only bcc/cc seem to be affected here.
 [2003-07-23 11:10 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 14:01:37 2015 UTC