Zend Framework

clear Recipients function

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.7.2
  • Fix Version/s: 1.7.3
  • Component/s: Zend_Mail
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

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(); unset($this->_headers['To']); unset($this->_headers['Cc']); unset($this->_headers['Bcc']); }

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

Issue Links

Activity

Hide
Nico Edtinger added a comment -

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

Show
Nico Edtinger added a comment - 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?!
Hide
Gunter Spöcker added a comment -

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.

Show
Gunter Spöcker added a comment - 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.
Hide
Tomas Korcak added a comment -

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

Show
Tomas Korcak added a comment - 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().
Hide
Satoru Yoshida added a comment -

I think it duplicates ZF-1626

Show
Satoru Yoshida added a comment - I think it duplicates ZF-1626

People

Vote (2)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: