I'd like to use a view as an email body.
I tried this one:
$renderer = new PhpRenderer();
$bodyHtml = $renderer->render(
'/user/email/reset-password-email',
[
'passwordResetUrl' => $passwordResetUrl,
]);
$html = new MimePart($bodyHtml);
I get the following error:
Unable to render template "/user/email/reset-password-email"; resolver could not resolve to a file
My view-template is located in:
Any help appreciated.
To render view as string, you need a renderer "ViewRenderer
".
If you can get ServiceManager, then,
$renderer = $serviceManager->get('ViewRenderer');
Now,
$bodyHtml = $renderer->render(
'/user/email/reset-password-email',
[
'passwordResetUrl' => $passwordResetUrl,
]);
$html = new MimePart($bodyHtml);