diff --git a/Classes/Utility/MailUtility.php b/Classes/Utility/MailUtility.php
index 78aca87..c6403d3 100644
--- a/Classes/Utility/MailUtility.php
+++ b/Classes/Utility/MailUtility.php
@@ -26,6 +26,49 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
*/
class MailUtility
{
+ /**
+ * Parse text with a simple "template system" to be used as data for
+ * sendMail function
+ *
+ * @param string $text
+ * @param array $markers
+ * @return array
+ */
+ public static function parseContentTemplate(
+ $text,
+ $markers = []
+ ) {
+ $textParts = explode("\r\n\r\n", $text);
+ $result = [];
+ foreach ($textParts as $textPart) {
+ $type = 'text';
+ if (substr($textPart, 0, 2) === '# ') {
+ $type = 'headline';
+ $textPart = substr($textPart, 2);
+ }
+ if (substr($textPart, 0, 3) === '## ') {
+ $type = 'headline2';
+ $textPart = substr($textPart, 3);
+ }
+ if (substr($textPart, 0, 4) === '### ') {
+ $type = 'headline3';
+ $textPart = substr($textPart, 4);
+ }
+ foreach ($markers as $markerName => $markerContent) {
+ $textPart = str_replace(
+ '###' . $markerName . '###',
+ $markerContent,
+ $textPart
+ );
+ }
+ $result[] = [
+ 'type' => $type,
+ 'data' => $textPart,
+ ];
+ }
+ return $result;
+ }
+
/**
* tages maildata, builds html and text mails an decides where to send them
* allows to intercept sender for testing
@@ -88,6 +131,8 @@ class MailUtility
switch($row['type']) {
case 'text':
case 'headline':
+ case 'headline2':
+ case 'headline3':
$htmlRow = $row;
$htmlRow['data'] = preg_replace_callback(
'/\[.*\]/mU',
diff --git a/Resources/Private/Partials/Mails/DefaultHtml.html b/Resources/Private/Partials/Mails/DefaultHtml.html
index c5e88fd..d30001a 100644
--- a/Resources/Private/Partials/Mails/DefaultHtml.html
+++ b/Resources/Private/Partials/Mails/DefaultHtml.html
@@ -3,7 +3,7 @@
-
+