Issues

ZF-1626: Add methods for removing or replacing headers

Issue Type: New Feature Created: 2007-06-25T15:00:04.000+0000 Last Updated: 2011-08-03T15:04:22.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Nico Edtinger (nico) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: - ZF-3377

Attachments:

Description

[reported by tim weyand http://nabble.com/Zend_Mail---Zend_Mail_Transport_…]

Feature "Wish" : Could "delTo", "delCc", "delBcc", "delSubject", "delFrom" methods be added to Zend_Mail?

Comments

Posted by Bill Karwin (bkarwin) on 2007-06-27T10:35:52.000+0000

Assigned to Nico.

Posted by Bill Karwin (bkarwin) on 2007-06-28T20:13:15.000+0000

Marking fix version as unknown. Please set fix version when this issue is resolved.

Posted by Tim Weyand (tweyand) on 2007-07-03T06:43:32.000+0000

In my opinion, it should be possible to delete settings, which have been set by the script.

["delTo", "delCc", "delBcc" (name sugesstion)]

After an email was send, in most cases it is neccessary to clear the receipient list. Currently you can add "infinite" receipients to your reseipient list, but you can not delete any.

I think most people wouldn't need to delete a specific email adress out of the To,Cc,Bcc list, so i would sugesst that an delTo would delete alle receipients in the "To receipient list".

Alternatively an "delReceipientList" would be easier to implement, but was in the past declined http://framework.zend.com/issues/browse/ZF-30.

I wrote an class which extends Zend_Mail, in this class i implemented a "delReceipientList".

public function delReceipientList() { $this->_to=array(); $this->_recipients=array(); if (isset($this->_headers['To'])) unset($this->_headers['To']); if (isset($this->_headers['Cc'])) unset($this->_headers['Cc']); if (isset($this->_headers['Bcc'])) unset($this->_headers['Bcc']); }

[delFrom] In some cases you change not only the receipient, but also the sender. This case is for example a greeting card, a news article which you want to send a friend ...

Currently you can set the from header only ones, otherwise you get an exception. Which is actually good, but there should be an method to delete the From Header.

Maybe something like this :

public function delFrom() { if (!is_null($this->_from)) $this->_from=null; if (isset($this->_headers['From'])) unset($this->_headers['From']); }

[delSubject] The same as the from header, you can only set the subject line ones - otherwise you get an exception. This is not that important for myself, but for the purpose of completion it should be implemented as well.

Maybe something like this :

public function delSubject() { if (!is_null($this->_subject)) $this->_subject=null; if (isset($this->_headers["Subject"])) unset($this->_headers["Subject"]); }

I hope this helps.

regards, Tim

Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-01-03T04:23:58.000+0000

Implemented in SVN r13499.

I added Following functions

_clearHeader($headerName) clearRecipients() clearFrom() clearReturnPath() clearSubject() clearDate()

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts