protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $mandrill = $this->getContainer()->get('app.mandrill');
     $em = $this->getContainer()->get('doctrine')->getManager();
     $licenseRepo = $em->getRepository('AppBundle:License');
     $drillRegisteredEventRepo = $em->getRepository('AppBundle:DrillRegisteredEvent');
     $eventsToSend = $drillRegisteredEventRepo->findEventsToSendToday();
     foreach ($eventsToSend as $eventToSend) {
         $registeredSchema = $eventToSend->getDrillRegisteredSchema();
         $license = $licenseRepo->findOneBy(['licenseId' => $registeredSchema->getLicenseId(), 'addonKey' => $registeredSchema->getAddonKey()]);
         $recipients = $this->getRecipients($license);
         $bcc = $this->getContainer()->getParameter('vendor_email');
         $event = $eventToSend->getDrillSchemaEvent();
         $message = MandrillMessage::prepareMessage($license, $event, $recipients, $bcc);
         try {
             $response = $mandrill->messages->send($message, true);
             print_r($response);
             $eventToSend->setStatus('sent');
             $output->writeln(sprintf('[%s] %s - sent', $registeredSchema->getLicenseId(), $registeredSchema->getAddonKey()));
         } catch (\Exception $e) {
             $eventToSend->setStatus('error');
             $output->writeln($e->getMessage());
         }
         $em->persist($eventToSend);
         $em->flush();
     }
     $output->writeln('Done');
 }
 /**
  * @Route("/event/{id}/send-test", name="event_send_test")
  */
 public function sendTestAction(DrillSchemaEvent $event)
 {
     $license = $this->getDoctrine()->getRepository('AppBundle:License')->findOneBy(['licenseId' => 'SEN-3253462']);
     $mandrill = $this->get('app.mandrill');
     $recipients = [['email' => $this->container->getParameter('vendor_email')]];
     $message = MandrillMessage::prepareMessage($license, $event, $recipients);
     $mandrill->messages->send($message, true);
     return $this->redirectToRoute('events');
 }