Hi ,
how can i send custom data to an email template ?
the email is sent correctly but the data is not rendered in the template ...
the body of the template is something like
"Lorem ipsum dolor {customName} sit amet"
how can i send custom data to an email template ?
the email is sent correctly but the data is not rendered in the template ...
the body of the template is something like
"Lorem ipsum dolor {customName} sit amet"
Code:
/* EMAIL PROCESS */
/** @var Email $email */
$email = $this->getEntityManager()->getEntity('Email');
/** @var EmailTemplate $emailTpl */
$emailTpl = $this->getEntityManager()->getEntity('EmailTemplate', $templateId);
//$subjectTpl = $emailTpl->get("subject");
$emailParam = [
'subject' => $emailTpl->get("subject"),
'body' => $emailTpl->get("body"),
'isHtml' => true,
'from' => $from,
'replyTo' => $replyTo,
'to' => $to,
'customName' => $customValue
];
$email->set($emailParam);
try {
$this->getContainer()->get("mailSender")->send($email);
} catch (\Exception $e) {
return [
'response' => 'error',
'message' => 'EmailNotification: [' . $e->getCode() . '] ' . $e->getMessage(),
];
}
