Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0

Bug #8047 Cc and Bcc handling
Submitted: 2006-06-28 06:46 UTC
From: ahayes at wcg dot net dot au Assigned:
Status: Bogus Package: Mail (version 1.1.10)
PHP Version: 5.1.4 OS: FC5
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 12 - 5 = ?

 
 [2006-06-28 06:46 UTC] ahayes at wcg dot net dot au (Alex Hayes)
Description: ------------ It seems as tho the Mail factory 'smtp' behaves a little differently to its cousins 'mail' and 'sendmail'. I realise that this could be the implementation of the sendmail program as I have recieved differing results on some servers, however at the very least it would be nice to have some clarification in the documentation. The problem lies in the handling of the Cc and Bcc headers. For example, with the 'mail' factory it will send the email out to those listed in the Cc and Bcc, 'smtp' does not. The reason for this I believe is because you must specify all the recipients in the 'recipients' parameter of the Mail_smtp::send() method. This is trivial, however if you are switching between mail factories a problem arises. Say for instance I do join up all my recipients (To, Cc & Bcc) for calls to Mail_mail::send() as I would have to for Mail_smtp::send(), Mail_mail::send() will cause those listed in the Cc and Bcc to be in the 'To' header when the email is delivered. So, either the 'recipient' param is just supposed to be those for the 'To' header, or there needs to be some modification of Mail_mail, however I would assume that this will be the harder of the two. A very simple fix (PHP5) for this would be as follows, however I am unsure if this breaks anything, or of the reason for this "bug" (if in fact it even is a bug and not a documentation issue). =============8<=============== class Mail_smtpfix extends Mail_smtp { function send($recipients, $headers, $body) { if(!empty($headers['Cc'])) { if(is_array($headers['Cc'])) { $headers['Cc'] = $this->parseRecipients($headers['Cc']);; } $recipients = is_array($recipients) ? array_merge($recipients, array($headers['Cc'])) : array($recipients, $headers['Cc']); } if(!empty($headers['Bcc'])) { if(!is_array($headers['Bcc'])) { $headers['Bcc'] = $this->parseRecipients($headers['Bcc']);; } $recipients = is_array($recipients) ? array_merge($recipients, array($headers['Bcc'])) : array($recipients, $headers['Bcc']); } return parent::send($recipients, $headers, $body); } } =============>8=============== Note that if this is not a bug with Mail_smtp then it means that the mail factories do not behave in the same manner, which, in my opinion, **kind of** breaks the factory based approach. Test script: --------------- <?php include('Mail.php'); include('Mail/mime.php'); $params['factory'] = 'smtp'; $params['options'] = array( 'host' => 'smtp.host.com' ); $params['crlf'] = "\r\n"; $params['hdrs'] = array( 'To' => 'example@example.com', 'From' => 'me@example.com', 'Cc' => 'friends@example.com', 'Subject' => 'Test Message' ); $text = "Parameter Information: \n\n" . var_export($params, true); $mime = new Mail_mime($params['crlf']); $mime->setTXTBody($text); $body = $mime->get(); $hdrs = $mime->headers($params['hdrs']); $mail =& Mail::factory($params['factory'], $params['options']); $result = $mail->send( $params['hdrs']['To'], $hdrs, $body ); var_dump($result); Expected result: ---------------- The email should arrive to both the To and the Cc recipients. Actual result: -------------- The email only arrives to the To.

Comments

 [2006-06-28 18:13 UTC] chagenbu at php dot net (Chuck Hagenbuch)
The fact that PHP's mail: function delivers to cc: and bcc: header addresses is because it doesn't have a proper recipients parameter. With Mail, you *must* specify the envelope recipients - anyone who should get the message - in the $recipients parameter. Headers are headers - they don't mean _anything_ about who the message should be delivered to.
 [2006-06-28 22:57 UTC] ahayes at wcg dot net dot au
So, then is it possible that Mail_mail can be modified, so that when it talks to PHP's mail it behaves properly? Or is this really something that should (but probably will not) be addressed with the mail function itself? My guess is the later.
 [2007-02-28 20:29 UTC] tkamin at argotinc dot com (Todd Kamin)
So, basically, the PEAR Mail class doesn't support Cc: or Bcc: functionality.
 [2007-03-04 01:03 UTC] testing83 at verizon dot net (testing83)
I am unable to use the Mail Factory with smtp to send a blind carbon copy (Bcc). The problem I am having is discussed in this bug report. If I don't place the bcc email address in the list of recipients then the email does not get sent to the bcc email address. If I place the bcc email address in the list of recipients then the email is sent but it not blind to the other recipients. I would really like to know how I can send an email which includes a bcc using the Mail Factory with an smtp mail server. Thank you.
 [2007-04-20 13:59 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-07-02 10:35 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-07-06 15:22 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2009-12-09 01:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-01-28 20:23 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-03-24 12:04 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-10-01 02:39 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-11-10 12:10 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-11-25 18:07 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2011-04-19 20:48 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2012-01-16 16:36 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2012-07-18 21:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2017-10-17 11:26 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!