|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21036 messages doubled with Bcc: header
Submitted: 2002-12-15 21:37 UTC Modified: 2002-12-28 21:04 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jphilyaw at philyawcs dot com Assigned:
Status: Closed Package: *Mail Related
PHP Version: 4.3.0RC3 OS: Win2000 Server
Private report: No CVE-ID: None
 [2002-12-15 21:37 UTC] jphilyaw at philyawcs dot com
I found a similar bug report (ID#20707) for PHP4.3RC2.  I tried the latest code linked to from there, as well as the Windows binary of RC3 offered on the main site page, but I still get the same result:

Each To: recipient receives the message once, but all addresses listed in the Bcc: header recieves the message twice.  I checked my mail server logs to insure it was not a server problem and confirmed that PHP was giving each address twice.

Thank you for your help.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-16 05:11 UTC]
Are you 100% sure you updated EVERY file in your system from the RC3 / snapshot package?

 [2002-12-16 11:46 UTC] jphilyaw at philyawcs dot com
Yes.  I deleted the entire directory as well as the php4apache.dll and php4ts.dll files from the /WINNT/system32 directory and installed the fresh copy from the zip file.  I tried it again just now to make sure that I wasn't missing something, but I still have this problem.  Thanks for the quick reply.
 [2002-12-28 01:39 UTC] jphilyaw at philyawcs dot com
I think I may have found the possible cause of the problem.

I'm new to programming, so please bear with me if I'm completely wrong.

I was looking through the code for sendmail.c and in the section for SendText, somewhere around line 521, you strip the Bcc from the headers.  This should work in theory, but shouldn't this be done *before* the Cc headers are done.  If the code is executed in sequence, the 'cc' part of the Bcc: headers are being picked up as Cc: headers and the addresses are sent a message, then the full Bcc: header is picked up and the recipients are sent a second message.

If this theory is correct, then wouldn't the problem be solved by moving the entire Bcc: header section, including the stripping function, to be run before the Cc: header section.  That way the Bcc headers are found and the messages are sent, the header is then stripped out, and if there are no real Cc: headers, then nothing happens, but if there are Cc: headers, then they have not been stripped and the message will be sent as needed.

I seem to be having trouble building PHP on my system, so I haven't been able to test this theory.  Please tell me what you think of my hypothesis.  Thanks again.
 [2002-12-28 13:34 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.

- else if (headers && (pos1 = strstr(headers_lc, "cc:"))) {
+ else if (headers && (pos1 = strstr(headers_lc, "cc:")) && ((pos1 == headers_lc) || !iscntrl(*(pos1-1)))) {

 [2002-12-28 21:04 UTC] jphilyaw at philyawcs dot com
That fixed the problem for me.  Thank you once again for all your help.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 03:01:28 2024 UTC