/** @noinspection PhpInconsistentReturnPointsInspection * @param MessageInterface $message * * @return TransportStatus */ public function send(MessageInterface $message) { $this->messages[] = $message; switch ($this->succeededStatus) { case static::SUCCEED: return new TransportStatus($message, 1); case static::SUCCEED_PARTIAL: return new TransportStatus($message, 1, $message->getRecipients()); case static::FAILED: return new TransportStatus($message, 0, $message->getRecipients()); } }
/** * Render a message and create a Swift_Message. * * @param MessageInterface $message * * @return \Swift_Message */ public function renderMessage(MessageInterface $message) { $swiftMessage = \Swift_Message::newInstance(); $swiftMessage->setTo($message->getRecipients()); $swiftMessage->setCc($message->getCopyRecipients()); $swiftMessage->setBcc($message->getBlindCopyRecipients()); $swiftMessage->setFrom($message->getFrom()); $swiftMessage->setSubject($message->getSubject()); $swiftMessage->setBody($message->getText(), 'text/plain'); return $swiftMessage; }
/** * Render a message and create a Swift_Message. * * @param MessageInterface $message * * @return \Swift_Message */ public function renderMessage(MessageInterface $message) { return $message->getMessage(); }
/** * @param TransportInterface $transport * @param MessageInterface $message * @param TransportStatus $status */ protected function logFailedStatus(TransportInterface $transport, MessageInterface $message, TransportStatus $status) { if ($this->logger) { $recipients = $this->prepareRecipientsForLogging($message->getRecipients()); $this->logger->error(sprintf('Could not transport message "%s" to %s via transport "%s": %s', $message->getSubject(), $recipients, get_class($transport), $status->getException()->getMessage()), array('message' => $message)); } if ($this->eventDispatcher) { $this->eventDispatcher->dispatch('avisota_queue_execution_post_transport', new PostTransportMessageEvent($message, $this, $status)); } }