<?php/** * Created by PhpStorm. * User: marcin * Date: 11/23/17 * Time: 10:21 AM */namespaceAppBundle\Controller;useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;useSymfony\Component\HttpFoundation\Response;useSymfony\Bundle\FrameworkBundle\Controller\Controller;classEmailControllerextendsController{/** * @Route("/email") */publicfunctionsendEmail(){$message=(new\Swift_Message('Hello Email'))->setFrom('***REMOVED***')->setTo('***REMOVED***@edu.easj.dk')->setBody($this->renderView(// app/Resources/views/Emails/registration.html.twig'emails/registration.html.twig',array('name'=>"Test")),'text/html')/** If you also want to include a plaintext version of the message->addPart($this->renderView('Emails/registration.txt.twig',array('name' => $name)),'text/plain')*/;//$mailer->send($message);// or, you can also fetch the mailer service this way$this->get('mailer')->send($message);}}