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

Request #5987 Support for Cc and Bcc recipients (patch supplied)
Submitted: 2005-11-16 16:30 UTC
From: msmulders at pronexus dot nl Assigned: quipo
Status: Closed Package: Mail_Queue
PHP Version: Irrelevant OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-16 16:30 UTC] msmulders at pronexus dot nl
Description: ------------ Mail::send() supports an Array as recipient to be able to send CC and BCC emails (see http://pear.php.net/manual/en/package.mail.mail.send.php). I have modified Mail_Queue to support this. See 'Test Script' below for the appropriate patches. Hereafter you can use an array like array('To'=>'user@address.com', 'Cc'=>'user2@domain.com,user3@domain.uk') as the $to parameter of Queue::put() NB: the field "recipient" in the database needs to be changed to type "text" instead of "varchar": ALTER TABLE `mail_queue` CHANGE `recipient` `recipient` TEXT NOT NULL; Test script: --------------- diff of Mail/Queue.php: 409a410,411 > if (is_array($to)) > $to = serialize($to); --------------------------------------------------------- diff of Mail/Queue/Body.php: 92c92 < * @var string --- > * @var mixed 134c134 < * @param string $recipient Reciepient e-mail --- > * @param mixed $recipient Reciepient e-mail 146a147,149 > $rcpt_array = @unserialize($recipient); > if ($rcpt_array!==FALSE) > $recipient=$rcpt_array; 260c263,266 < return stripslashes($this->recipient); --- > if (!is_array($this->recipient)) > return stripslashes($this->recipient); > else > return $this->recipient;

Comments

 [2005-11-16 16:49 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!
 [2005-11-17 07:21 UTC] msmulders at pronexus dot nl
Well, that would mean no package can ever update if it involves a database patch like this. IMO this is just as valid as a source patch. But I see your point. However, in the case of Mail_Queue it's a db table that functions as stack ... meaning it is supposed to and will be empty on a regular basis. So the breaking of existing data is almost a non-existant issue. Third I believe this is a critical bug for Mail_Queue. Any serious use of this package will want to have the functionality. That is why this should be implemented asap and that is also why I put this patch online for the general public. This is Open Source - people need this fixed and this way they can fix it if they want. Concluding; I really like this package and it's potential... but it's quite unuseable without cc/bcc. So even if it involves going a major version higher or something to be 'allowed' to release this BC breaking patch... I would urge you to do so :) Thanks for all your work!
 [2005-11-17 12: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!
 [2005-12-08 15:44 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!
 [2005-12-12 08:11 UTC] msmulders at pronexus dot nl
I've tested the CVS version with MySQL backend. Used the mysql.sql from CVS (v1.2) Tested both ways like: $to = array ( 'To'=>'user1@server1.com,user2@server2.com', 'Cc'=>'user3@server3.com' ); and $to = 'oneuser@server.com'; The recipient gets saved to the database OK (serialized) and sending the mail functions properly. I may conclude the CVS version properly implements the multiple recipients functionality. Great job! I only have one remark; it's kind of odd to see the mail delivered at the recipient without 'To' or 'Cc' fields visible to the client. Apparently these have to get set explicitly in the headers by the coder before mailqueue->put(). Not a bad thing IMO, experienced programmers will have no trouble. But with the multiple recipients it's easy to forget to put for example the Cc recipient into the headers. Therefor it would be nice if Mail_Queue also had some friendlier wrapper function(s) to relieve the coder from the Mail::Mime stuff to get headers and body. For example: function put ($from, $to, $subject, $body, $bodytype='text') {} or something similar. Mail_Queue itself would then use the Mail::Mime functions to produce the proper headers and body like in the tutorial. Just a thought :) Thanx.
 [2007-01-11 21:01 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!