Пример #1
0
 /**
  * @param ChannelBroadcastEvent $event
  */
 public function onBroadcast(ChannelBroadcastEvent $event)
 {
     if (!$event->checkContext('email')) {
         return;
     }
     // Get list of published broadcasts or broadcast if there is only a single ID
     $id = $event->getId();
     $emails = $this->model->getRepository()->getPublishedBroadcasts($id);
     $output = $event->getOutput();
     /** @var Email $email */
     while (($email = $emails->next()) !== false) {
         list($sentCount, $failedCount, $ignore) = $this->model->sendEmailToLists($email[0], null, 100, true, $output);
         $event->setResults($this->translator->trans('mautic.email.email') . ': ' . $email[0]->getName(), $sentCount, $failedCount);
         $this->em->detach($email[0]);
     }
 }