hi sending email templates email followas:
//here $emailbody twig template html.
$mailbody = $this->templating->render('test/template/layout.html.twig', array( 'mailbody' => $mailbody )); $tmp = $this->mailer->createmessage(); $tmp->setsubject(trim($emailsubject)); $tmp->setfrom('test@gmail.com'); $tmp->setto($somnerecipeient); $tmp->setbody($emailbody, 'text/html'); $sent = $this->mailer->send($tmp);
so when geting email inbox comes raw html.even content-type set text/html as:
$tmp->setbody($emailbody, 'text/html');
what issue, please assist
thanks advance
you should using renderview
, spelled content $mailbody
instead of $emailbody
. change so:
$emailbody = $this->templating->renderview('test/template/layout.html.twig', array( 'mailbody' => $mailbody ));
can try , see if resolves issue.
Comments
Post a Comment