From 27ac001d5b27cce4f80ce4b3335c14708b116830 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Tue, 14 Aug 2018 17:26:31 +0200 Subject: [PATCH] FIX email rendering should not include requirements If no body is defined, the email is rendered according to a template. Clearing requirements prevent unnecessary styles/scripts to be included in the html (and that needs to be processed/stripped down the line). --- src/Control/Email/Email.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Control/Email/Email.php b/src/Control/Email/Email.php index 230af870f..8d79db709 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -790,6 +790,9 @@ class Email extends ViewableData return $this; } + // Do not interfere with emails styles + Requirements::clear(); + // Render plain part if ($plainTemplate && !$plainPart) { $plainPart = $this->renderWith($plainTemplate, $this->getData()); @@ -806,6 +809,9 @@ class Email extends ViewableData $htmlPartObject = DBField::create_field('HTMLFragment', $htmlPart); $plainPart = $htmlPartObject->Plain(); } + + // Rendering is finished + Requirements::restore(); // Fail if no email to send if (!$plainPart && !$htmlPart) {