Пример #1
0
 /**
  * @param QueueItem $queueItem
  */
 protected function safeSend(QueueItem $queueItem)
 {
     $now = new \DateTime("now");
     $queueItem->setAckedAt($now);
     $this->saveQueueItem($queueItem);
     $message = $queueItem->getMessage();
     $campaign = $message->getCampaign();
     $template = $campaign->getTemplate();
     $subscriber = $queueItem->getSubscriber();
     $this->messageBuilder->setEntityVars($message, $campaign, $template, $subscriber, $queueItem);
     $headers = $this->messageBuilder->getHeaders();
     $messageBody = $this->messageBuilder->getBody($message->getBody(), $template->getBody());
     $subject = $this->messageBuilder->template($message->getSubject());
     $this->mail($subscriber, $campaign, $subject, $messageBody, $headers);
     $queueItem->setSentAt($now);
     $this->saveQueueItem($queueItem);
 }