<?php/** * Created by PhpStorm. * User: marcin * Date: 01/12/17 * Time: 10:47 */namespaceAppBundle\Utils;useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;useSymfony\Bundle\FrameworkBundle\Controller\Controller;useSwift_SmtpTransport;useSwift_Mailer;useSwift_Message;classEmailSenderextendsController{publicfunctionsendEmail(array$data){// 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('emails/warning.html.twig',$data),'text/html');// Send the message$result=$mailer->send($message);}}