Ejemplo n.º 1
0
 /**
  * Sends the specified message.
  *
  * @param Message $message the message to be sent
  * @return boolean whether the message is sent successfully
  */
 protected function sendMessage($message)
 {
     \Yii::info('Sending email "' . $message->getSubject() . '" to "' . implode(', ', $message->getTo()) . '"', self::LOG_CATEGORY);
     try {
         if ($this->useMandrillTemplates) {
             return $this->wasMessageSentSuccesfully($this->_mandrill->messages->sendTemplate($message->getTemplateName(), $message->getTemplateContent(), $message->getMandrillMessageArray(), $message->isAsync(), null, $message->getSendAt()));
         } else {
             return $this->wasMessageSentSuccesfully($this->_mandrill->messages->send($message->getMandrillMessageArray(), $message->isAsync(), null, $message->getSendAt()));
         }
     } catch (Mandrill_Error $e) {
         \Yii::error('A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(), self::LOG_CATEGORY);
         return false;
     }
 }