public function inscrireAction(Request $request)
 {
     if ('POST' === $request->getMethod()) {
         $email = $_POST['email'];
         $em = $this->getDoctrine()->getEntityManager();
         $entity = $em->getRepository('PortailNewsletterBundle:Newsletter')->ExistEmail($em, $email);
         if (!$entity) {
             $entity1 = new UserNewsletterInscris();
             $entity1->setEstconfirm(false);
             $entity1->setEmail($email);
             $em->persist($entity1);
             $message = \Swift_Message::newInstance()->setSubject('Confirmation d"inscription Newsletter')->setFrom(array('*****@*****.**' => 'PortailHorus'))->setTo($email)->setBody($this->renderView('PortailNewsletterBundle:Newsletter:confirm.html.twig', array('email' => $email)), 'text/html');
             $this->get('mailer')->send($message);
             $em->flush();
         }
         return $this->redirect($this->generateUrl('portail_front_homepage'));
     }
     return $this->redirect($this->generateUrl('portail_front_homepage'));
 }
 public function EnvoiMailConfirmation($em, $email)
 {
     // $entity = $em->getRepsository('PortailFrontBundle:Newsletter')->ExistEmail($em,$email);
     //if(!$entity) {
     $entity1 = new UserNewsletterInscris();
     $entity1->setEstconfirm(false);
     $entity1->setEmail($email);
     $em->persist($entity1);
     $message = \Swift_Message::newInstance()->setSubject('Confirmation d"inscription Newsletter')->setFrom(array('*****@*****.**' => 'PortailHorus'))->setTo($email)->setBody($this->container->get('templating')->renderResponse('PortailFrontBundle:Newsletter:confirm.html.twig', array('email' => $email)), 'text/html');
     $this->container->get('mailer')->send($message);
     $em->flush();
     //}
     return true;
 }