From 449431b5c1a27ef59ea2f4c5e99a8aa7e120daf3 Mon Sep 17 00:00:00 2001 From: Travis Swientek Date: Sat, 3 Aug 2013 14:56:38 -0700 Subject: [PATCH] Added tagging ability to MessageBuilder --- src/Mailgun/Messages/MessageBuilder.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Mailgun/Messages/MessageBuilder.php b/src/Mailgun/Messages/MessageBuilder.php index 961a956..d4709e9 100644 --- a/src/Mailgun/Messages/MessageBuilder.php +++ b/src/Mailgun/Messages/MessageBuilder.php @@ -17,6 +17,7 @@ class MessageBuilder extends Messages{ protected $attachmentCount = 0; protected $campaignIdCount = 0; protected $customOptionCount = 0; + protected $tagCount = 0; protected $httpBroker; public function __construct($httpBroker){ @@ -228,6 +229,22 @@ class MessageBuilder extends Messages{ } } + public function addTag($tag){ + if($this->tagCount < 3){ + if(isset($this->message['o:tag'])){ + array_push($this->message['o:tag'] , $tag); + } + else{ + $this->message['o:tag'] = array($tag); + } + $this->tagCount++; + return true; + } + else{ + throw new TooManyParameters("You've exceeded the maximum (3) tags for a single message."); + } + } + public function setDkim($enabled){ if(filter_var($enabled, FILTER_VALIDATE_BOOLEAN)){ $enabled = "yes";