Skip to content

Commit c632272

Browse files
committed
Parse email html body
Allowing project to manipulate the html prior to sending email.
1 parent 50b34bb commit c632272

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/EventSubscriber/EmailSubscriber.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ protected function sendMessage(string $templateName, array $context, $toEmail, $
9999
$htmlBody = null;
100100

101101
if ($template->hasBlock('body_html', $context)) {
102-
$htmlBody = $template->renderBlock('body_html', $context);
102+
$htmlBody = $this->parseHtmlBody(
103+
$template->renderBlock('body_html', $context)
104+
);
103105
}
104106

105107
$email = (new Email())
@@ -118,4 +120,14 @@ protected function sendMessage(string $templateName, array $context, $toEmail, $
118120

119121
$this->mailer->send($email);
120122
}
123+
124+
/**
125+
* @param string $htmlBody
126+
*
127+
* @return string
128+
*/
129+
protected function parseHtmlBody(string $htmlBody): string
130+
{
131+
return $htmlBody;
132+
}
121133
}

0 commit comments

Comments
 (0)