From: ("icoman")
Date:  17 Oct 2017 21:23:45 Hong Kong Time

[PEAR-BUG] Bug #8047 [Com]: Cc and Bcc handling

NNTP-Posting-Host:  null

Edit report at

 ID:               8047
 Comment by:       icoman
 Reported By:      dan_gro1 at yahoo dot com
 Summary:          Cc and Bcc handling
 Status:           Bogus
 Type:             Bug
 Package:          Mail
 Operating System: FC5
 Package Version:  1.1.10
 PHP Version:      5.1.4
 New Comment:

For me worked only these combination:

--- customized by me:

$headers = array(
'From'          => $name." <".$sender.">",
'Return-Path'   => $sender,
'Subject'       => $subject,
'To'        => $recipient,
'Bcc'	    => $Bcc

$result = $mail->send($recipient, $headers, $body);
$resultA = $mail->send($Bcc, $headers, $body);

with $resultA the email to $Bcc email will be delivered.

Previous Comments:

[2012-07-18 17:47:55] fgabrieli

Hi all, the following worked for me (based on brozra solution):

       $headers = array('MIME-Version'                 => '1.0',
                         'Reply-to'                     =>
                         'To'                           => $this->to,
                         'Content-type'                 => 'text/html;
                         'Content-Transfer-Encoding'    => 'base64');

        $smtpTo = array('To' => $this->to);        
        if ($this->getCc()) {
            $headers = array_merge($headers, array('CC' =>
            $smtpTo = array_merge($smtpTo, array('CC' =>
        if ($this->getBcc()) {
            $smtpTo = array_merge($smtpTo, array('BCC' =>
                    chunk_split( base64_encode($this->body) ), 

best regards,
Fernando Gabrieli


[2012-01-16 11:36:28] eis_ltd

Have you tried using $message->addTo, $message->addCc, etc.? These made
the difference for me.


[2011-04-19 16:48:11] cami

This IS (or at least most of it is) a bug in PEAR Mail_mail.

PHP mail() manual explicitly states that CC/BCC recipients should be
specified in extra headers ONLY, not in the recipients argument.

in contrast Mail::send() manual explicitly states that ALL envelope
recipients (including CC/BCC) must be listed in the recipients

Thus, Mail_mail MUST filter out all envelope recipients that are listed
in a CC/BCC header before calling mail(). This is a mail()  limitation
that can only be worked around by inspecting message headers.

HOWEVER the fact that some mail() backends or php patches (like suhosin)
ignore the CC/BCC headers passed to mail() is obviously an error in
mail() and not in PEAR Mail_mail.

Please fix the first part as switching the mailer backend must not
change mail::send() semantics! Currently, one must manually detect the
backend and filter CC/BCC from recipients if (and only if) it is


[2010-11-25 13:07:18] mcnaldo

Thank you Brozra, that was a great tip! Specifically the part about the
PEAR module understanding if you put the To, Cc and Bcc addresses into
an array:

/* Combine the TO and BCC here - PEAR SMTP must have all e-mails as the
main recipient. The KEY => VALUE assignments here are understood by the
PEAR module and will route them appropriately. */ $smtp_to = array (
'To' => $to, 'Bcc' => $bcc_emails);

Just to make it clear. The header part only affects how the message
looks, not where it gets sent. The send part specifies where to send the
messages (and also affects what shows up in the 'To' part of the


[2010-11-10 07:10:20] brozra

Switch to a hosting company that has the latest PEAR modules.  That
would probably be the easiest solution.  No point in beating yourself up
on trying to find a solution for outdated software.

Shameless company plug follows:
We've got all the latest PEAR, Ruby on Rails, PHP, cPanel, you name it. 
We update as soon as a stable release is available for everything.


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

Edit this bug report at