diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index d1a959b5410b0dbca5ae799a9f6959d0c8d68a04..b3654f303824a1012e60d00348868ad2423ad78c 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -435,8 +435,8 @@ EOF;
 			$text = htmlspecialchars($text);
 		}
 
-		$this->ensureBodyIsOpened();
 		$this->ensureBodyListClosed();
+		$this->ensureBodyIsOpened();
 
 		$this->htmlBody .= vsprintf($this->bodyText, [$text]);
 		if ($plainText !== false) {