Bug #8047 [Com]: Cc and Bcc handling

From: Date: Tue, 17 Oct 2017 13:23:45 +0000
Subject: Bug #8047 [Com]: Cc and Bcc handling
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-11404@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=8047&edit=1 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' => $this->getFrom(), 'To' => $this->to, 'Content-type' => 'text/html; charset=ISO-8859-1', 'Content-Transfer-Encoding' => 'base64'); $smtpTo = array('To' => $this->to); if ($this->getCc()) { $headers = array_merge($headers, array('CC' => $this->getCc())); $smtpTo = array_merge($smtpTo, array('CC' => $this->getCc())); } if ($this->getBcc()) { $smtpTo = array_merge($smtpTo, array('BCC' => $this->getBcc())); } $this->send($this->getFrom(), $smtpTo, $this->subject, chunk_split( base64_encode($this->body) ), $headers); 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 parameter. 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 Mail_mail. ------------------------------------------------------------------------ [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 message). ------------------------------------------------------------------------ [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. http://www.brozra.com ------------------------------------------------------------------------ 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 http://pear.php.net/bugs/bug.php?id=8047 -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=8047&edit=1

« previous php.pear.bugs (#11404) next »