em = $em; $this->process = $process; $this->storage = $storage; $this->mailer = $mailer; $this->templating = $templating; } public function sendMailNotification(\TicketSupportBundle\Interfaces\TicketItemInterface $ticketItem){ // $template = $this->render('@TicketSupport/MailTemplate/email.notification.html.twig',['ticketItem'=>$ticketItem]); $address =$ticketItem->getCustomer()->getEmail(); $template = '@TicketSupport/MailTemplate/email.notification.html.twig'; $subject = $ticketItem->getSubject(); $parameters = array( 'ticketItem'=>$ticketItem ) ; $this->sendEmail($address, $template, $parameters, $subject); } public function sendEmail($address, $view, array $parameters, $subject){ $mail = (new \Swift_Message($subject)) ->setFrom(array('support-euro4x4@euro4x4.com' => 'Euro 4x4')) ->setTo($address) ->setCharset('utf-8') ->setContentType('text/html') //->setBody($this->renderView($view)); ->setBody($this->templating->render($view, $parameters)); $this->mailer->send($mail); } }