ZF-3377: clear Recipients function

Issue Type: Improvement Created: 2008-06-03T16:21:22.000+0000 Last Updated: 2011-08-20T15:08:37.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Gunter Spöcker (gunter) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: - ZF-1626



I would suggest to add a function "clearRecipients()" to Zend_Mail. It allows one to send personalised mails to more than one recipient without creating a new mail object each time:

public function clearRecipients() { $this->_to = array(); $this->_recipients = array();



So it's possible to do something like this: - create mail object, set subject and so on - add recipient - set mail text to something like "Dear Mr Miller, ..." - send mail - clear recipients - add new recipient - set mail text to something like "Dear Mrs Miller, ..." - send mail ...


Posted by Nico Edtinger (nico) on 2008-06-18T10:08:12.000+0000

I'm not sure how useful this is. What you want to do can be solved by just creating a new Zend_Mail object. The only property you don't change (or maybe you just didn't mention it) is the subject. As long as you reuse the transport (if you're using SMTP) sending multiple mails is not a problem. But maybe I'm just missing something?!

Posted by Gunter Spöcker (gunter) on 2008-06-18T10:23:29.000+0000

A more important example would be attachments. Imagine you have attached some images and other files to one mail object, it's not a very good idea to load all this data for every single mail, just because you want to change the recipient.

Posted by Tomas Korcak ('jsa) on 2008-07-10T05:42:12.000+0000

Totally agree with Gunter. It is the basic functionallity. Why would i have to create new object while i can reuse some. Please consider that. I need fx. clearRecipients(), clearSubject().

Posted by old of Satoru Yoshida ( on 2009-01-03T03:58:38.000+0000

I think it duplicates ZF-1626

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.