Esempio n. 1
0
 /**
  * @param MessageInterface $message
  * @param RecipientInterface $recipient
  * @return mixed|void
  */
 protected function send(MessageInterface $message, RecipientInterface $recipient)
 {
     $pushoverMessage = new Message($this->token, $recipient->getInfo('pushover.user_key'));
     $pushoverMessage->setMessage($message->getSubject(), $message->getContent());
     $pushoverMessage->setPriority(0, 60, 120);
     $pushoverMessage->send();
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 protected function send(MessageInterface $message, RecipientInterface $recipient)
 {
     $mail = clone $this->message;
     $mail->setTo($recipient->getInfo('email'));
     $mail->setSubject($message->getSubject());
     $mail->setBody($message->getContent(), 'text/html');
     $this->mailer->send($mail);
 }
Esempio n. 3
0
 /**
  * Check if the handler handles the
  *
  * @param MessageInterface $message
  * @return bool
  */
 public function isHandling(MessageInterface $message)
 {
     if (is_array($this->types)) {
         return in_array($message->getType(), $this->types);
     } elseif (is_string($this->types)) {
         return $this->types == Notifier::TYPE_ALL;
     }
     return false;
 }
 /**
  * {@inheritdoc}
  */
 protected function sendBulk(MessageInterface $message, array $recipients)
 {
     $emails = array();
     foreach ($recipients as $recipient) {
         $emails[$recipient->getInfo('email')] = $recipient->getInfo('email');
     }
     $mail = $message->getFormatted('swiftmailer');
     $mail->setTo($emails);
     $this->mailer->send($mail);
 }
Esempio n. 5
0
 private function sendStomp(MessageInterface $message, RecipientInterface $recipient)
 {
     $stomp = $this->connectSTOMP();
     if ($stomp) {
         $frame = new Frame('SEND', $this->stompheaders, $message->getContent());
         $res = $stomp->send('/queue/' . $this->stompdestination, $frame, array(), true);
         return $res;
     } else {
         return false;
     }
 }
Esempio n. 6
0
 protected function send(MessageInterface $message, RecipientInterface $recipient)
 {
     $oProwl = new Connector();
     $oMsg = new Message();
     try {
         $oProwl->setIsPostRequest(true);
         $oMsg->setPriority(0);
         $oProwl->setFilterCallback(function ($sText) {
             return $sText;
         });
         $oMsg->addApiKey($recipient->getInfo('prowl_app.api_key'));
         $oMsg->setEvent($message->getSubject());
         $oMsg->setDescription($message->getContent());
         $oMsg->setApplication($this->appName);
         $oResponse = $oProwl->push($oMsg);
         if ($oResponse->isError()) {
             $this->errors[] = $oResponse->getErrorAsString();
         }
     } catch (\InvalidArgumentException $oIAE) {
         $this->errors[] = $oIAE->getMessage();
     } catch (\OutOfRangeException $oOORE) {
         $this->errors[] = $oOORE->getMessage();
     }
 }
Esempio n. 7
0
 /**
  * Apply all logic to get the correct channels for the current recipient.
  *
  * @param  MessageInterface   $message
  * @param  RecipientInterface $recipient
  * @return ChannelInterface[]
  */
 private function getChannels(MessageInterface $message, RecipientInterface $recipient)
 {
     $channels = $this->channelResolver->getChannels($message->getType(), $this->getChannelStore());
     return $this->channelResolver->filterChannels($recipient, $message->getType(), $channels);
 }
Esempio n. 8
0
 /**
  * {@inheritDocs}
  */
 protected function send(MessageInterface $message, RecipientInterface $recipient)
 {
     $to = $recipient;
     $headers = implode("\r\n", $this->headers);
     mail($to, $message->getSubject(), $message->getContent(), $headers);
 }