I have following code to send the mail
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 $x->render('EnsNewBundle:Email:ind.html.twig', array('name' => $name));
// return $z;
}
I want to set the template file ind.html.twig as the body of the mail. This function is not in the controller and I dont want to use any service.
How can I do this ?
You can get the string resulting from rendering a template using: