ZF-3377: clear Recipients function


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 ...


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?!

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.

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().

I think it duplicates ZF-1626