Permalink
Browse files

Added some functions to reset the list of people you wanted to send e…

…mails to. Especially handy when you want to override the original destination of an email in debug builds for example.
  • Loading branch information...
1 parent 4a8a65c commit 7f09459f7bb1c302e7a1c5c46510df487ac4ecc2 @rikh42 committed Mar 11, 2013
Showing with 66 additions and 0 deletions.
  1. +66 −0 email/EmailAbstract.php
View
66 email/EmailAbstract.php
@@ -189,6 +189,72 @@ public function replyTo($email, $name = null)
/**
+ * Clears all the To Address list
+ * @return EmailAbstract
+ */
+ public function resetTo()
+ {
+ $this->to = array();
+ return $this;
+ }
+
+
+ /**
+ * Reset the list of CC emails
+ * @return EmailAbstract
+ */
+ public function resetCc()
+ {
+ $this->cc = array();
+ return $this;
+ }
+
+
+ /**
+ * Reset the list of Bcc email addresses
+ * @return EmailAbstract
+ */
+ public function resetBcc()
+ {
+ $this->bcc = array();
+ return $this;
+ }
+
+
+ /**
+ * Reset the list of To, Cc and Bcc email addresses
+ * @return EmailAbstract
+ */
+ public function resetAllTo()
+ {
+ return $this->resetTo()->resetCc()->resetBcc();
+ }
+
+
+ /**
+ * Reset the From address
+ * @return EmailAbstract
+ */
+ public function resetFrom()
+ {
+ $this->from = '';
+ return $this;
+ }
+
+
+ /**
+ * Reset the ReplyTo Address
+ * @return EmailAbstract
+ */
+ public function resetReplyTo()
+ {
+ $this->replyTo = '';
+ return $this;
+ }
+
+
+
+ /**
* @param $email - An email address
* @param $name - the name of the person
* @return array - containing email, name and prepared entries

0 comments on commit 7f09459

Please sign in to comment.