Ejemplo n.º 1
0
 public function sendForgotManageLinkMail($email)
 {
     $results = $this->em->getRepository('IntractoSecretSantaBundle:Pool')->findAllAdminPools($email);
     if (count($results) == 0) {
         return false;
     }
     $poolLinks = array();
     foreach ($results as $result) {
         $text = $this->translator->trans('manage.title');
         if ($result['date'] instanceof \DateTime) {
             $text .= ' (' . $result['date']->format('d/m/Y') . ')';
         }
         $poolLinks[] = array('url' => $this->routing->generate('pool_manage', array('listUrl' => $result['listurl']), Router::ABSOLUTE_URL), 'text' => $text);
     }
     $this->translator->setLocale($results[0]['locale']);
     $message = \Swift_Message::newInstance()->setSubject($this->translator->trans('emails.forgot_link.subject'))->setFrom($this->adminEmail, $this->translator->trans('emails.sender'))->setTo($email)->setBody($this->templating->render('IntractoSecretSantaBundle:Emails:forgotlink.txt.twig', array('poolLinks' => $poolLinks)))->addPart($this->templating->render('IntractoSecretSantaBundle:Emails:forgotlink.html.twig', array('poolLinks' => $poolLinks)), 'text/html');
     $this->mailer->send($message);
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @param Pool $pool
  */
 public function sendPoolMatchesToAdmin(Pool $pool)
 {
     $this->translator->setLocale($pool->getLocale());
     $this->mailer->send(\Swift_Message::newInstance()->setSubject($this->translator->trans('emails.admin_matches.subject'))->setFrom($this->adminEmail, $this->translator->trans('emails.sender'))->setTo($pool->getOwnerEmail(), $pool->getOwnerName())->setBody($this->templating->render('IntractoSecretSantaBundle:Emails:admin_matches.html.twig', array('pool' => $pool)), 'text/html')->addPart($this->templating->render('IntractoSecretSantaBundle:Emails:admin_matches.txt.twig', array('pool' => $pool)), 'text/plain'));
 }