/**
  * notify 
  * 
  * @param Message $message Message to send
  *
  * @access public
  * @return NotificationStatus
  * @throws MessagingException
  */
 public function notify(Message $message, $options = array())
 {
     $logger = $GLOBALS['logger'];
     $logger->debug('Sending SMS ', array($message->getFrom(), $message->getBody()));
     $path = 'notifications/sms/send';
     $request = $this->_remoteServer->post($path);
     $request->setPostField('type', 'sms');
     $request->setPostField('from', $message->getFrom());
     $request->setPostField('to', implode(';', $message->getRecipients()));
     $request->setPostField('content', $message->getBody());
     if (isset($options['priority'])) {
         $request->setPostField('priority', $options['priority']);
     }
     try {
         $response = $request->send();
         if ($response->getStatusCode() !== 200) {
             throw new MessagingException();
         }
         $rawResponse = $response->getBody('true');
         return $rawResponse;
     } catch (\Exception $e) {
         $logger->error($e->getMessage(), array());
         throw new MessagingException();
     }
 }
 /**
  * notify 
  * 
  * @param Message $message Message to send
  *
  * @access public
  * @return NotificationStatus
  * @throws MessagingException
  */
 public function notify(Message $message, $options = array())
 {
     $logger = $GLOBALS['logger'];
     $logger->debug('Sending Mail ', array($message->getRecipients(), $message->getBody()));
     $path = 'notifications/mail/send';
     // Check for number of attachments at the top
     $attachments = $message->getAttachments();
     if (count($attachments) > self::MAX_ATTACHMENTS) {
         throw new \InvalidArgumentException("Can only send maximum " . self::MAX_ATTACHMENTS . " attachments in a single mail.");
     }
     // The base request
     $request = $this->_remoteServer->post($path)->setPostField('type', 'sms')->setPostField('subject', $message->getSubject())->setPostField('to', implode(';', $message->getRecipients()))->setPostField('content', $message->getBody());
     // Add options if present
     if (isset($options['priority'])) {
         $request->setPostField('priority', $options['priority']);
     }
     if (isset($options['priority'])) {
         $request->setPostField('format', $options['format']);
     }
     if (!empty($attachments) && is_array($attachments)) {
         foreach ($attachments as $idx => $attachment) {
             if (!empty($attachment) && file_exists($attachment)) {
                 // TODO: Remove HACK - sending files as attach[0], attach[1], attach[2]
                 $request->addPostFile('attach[' . $idx . ']', $attachment);
             }
         }
     } else {
         // Force a multipart form data by attaching /dev/null
         $request->addPostFile('nullfile', '@/dev/null');
     }
     //// Add the duplicate aggregator for attachments
     //$request->getQuery()->setAggregator(new \Guzzle\Http\QueryAggregator\DuplicateAggregator);
     // Send the remote request
     try {
         $response = $request->send();
         if ($response->getStatusCode() !== 200) {
             throw new MessagingException();
         }
         $rawResponse = $response->getBody('true');
         return $rawResponse;
     } catch (\Exception $e) {
         throw new MessagingException();
     }
 }