I want to get the render of an email before to send it.
I created a TemplatedEmail
with htmlTemplate
and context
, it works fine for sending but how get the generated template with context to save it in database ? (customer needs)
I tried the getBody()
but seems to work only with text template as I get A message must have a text or an HTML part or attachments.
$email = new TemplatedEmail();
$email->htmlTemplate($htmlTemplate);
$email->from($from)->to(...$to)->subject($subject);
$email->context($context);
dd($email->getBody());
I thought to use the render method but I'm in a service and not sure if it's a good way to store in database.