<?php/** * Created by PhpStorm. * User: marcin * Date: 11/23/17 * Time: 10:21 AM */namespaceAppBundle\Controller;useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;useSymfony\Bundle\FrameworkBundle\Controller\Controller;useSwift_SmtpTransport;useSwift_Mailer;useSwift_Message;classEmailControllerextendsController{/** * @Route("/email") */publicfunctionsendEmail(){// Create the Transport$transport=(newSwift_SmtpTransport('mail.cock.li',465,'ssl'))->setUsername('***REMOVED***')->setPassword('***REMOVED***');// Create the Mailer using your created Transport$mailer=newSwift_Mailer($transport);// Create a message$message=(newSwift_Message('Pollutometer warning '.date('d/m/Y h:i:s')))->setFrom(['***REMOVED***'=>'Pollutometer'])->setTo(['***REMOVED***@edu.easj.dk'=>'A name'])->setBody($this->renderView(// templates/emails/warning.html.twig'warning.html.twig',array('name'=>'Test')),'text/html');// Send the message$result=$mailer->send($message);return$this->render('warning.html.twig',array('name'=>'Test'));}}