I have created a function file name as
<?php
use Ens\NewBundle\Controller\Services\MyMailers as MyMailers;
function NotificationOnSignUp($z)
{
$x=new MyMailers;
$x->setToloc($z['to']);
$x->setFromloc('ucerturohit@gmail.com');
$x->setSubject('Wonderful world');
$x->setBody('Hello world');
$z=$x->mail();
if($z==1)
$name='success';
else
$name='failed';
return $this->render('EnsNewBundle:Email:ind.html.twig',array('name'=>$name));
// return $z;
}
this file is not in the controller but I want to render my twig file in this file or I want to set this twig file as Body of the mail. how can i do this??
Create a service, inject the
templatingservice into it and use it to render the template.