Commit 3614c95a authored by Kevin von Spiczak's avatar Kevin von Spiczak
Browse files

[BUGFIX] replace newlines in mail layout too

Newlines were only replaced with <br>'s in the mail body, but not in the configured layout for this mail. This resulted in missing newlines in the layout (everything was more or less in one line).
parent bb6c3845
......@@ -944,10 +944,7 @@ class MailTemplateService {
empty($overwrittenEmailBody) ? $templateContent : $overwrittenEmailBody
);
// insert <br> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = $emailView->render();
$emailBody = \nl2br($emailBody);
$emailBody = \preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br><br>', $emailBody);
$layout = $this->getLayoutSource($layoutId, $siteRootId);
$emailHTMLHead = '';
......@@ -955,6 +952,10 @@ class MailTemplateService {
$emailHTMLHead = $layout->getHeadContent();
$emailBody = \str_replace('###CONTENT###', $emailBody, $layout->getContent());
}
// insert <br> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = \nl2br($emailBody);
$emailBody = \preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br><br>', $emailBody);
$this->mailBodyToSend = '<html><head>' . $emailHTMLHead . '</head><body>' . $emailBody . '</body></html>';
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment