From 1e69ff8a2546060976db0ac610cf049e1aab9622 Mon Sep 17 00:00:00 2001 From: Philipp Dieter Date: Tue, 22 Feb 2022 17:56:17 +0100 Subject: [PATCH] [TASK] Improve content handling of mailutility --- Classes/Utility/MailUtility.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Classes/Utility/MailUtility.php b/Classes/Utility/MailUtility.php index 3564ba6..2e6d41d 100644 --- a/Classes/Utility/MailUtility.php +++ b/Classes/Utility/MailUtility.php @@ -132,7 +132,8 @@ class MailUtility $data, $templateNameHtml = null, $templateNameText = null, - $templatePaths = null + $templatePaths = null, + $assetDomain = null ) { if (!$templateNameHtml) { $templateNameHtml = 'Mails/DefaultHtml'; @@ -194,6 +195,11 @@ class MailUtility case 'headline': case 'headline2': case 'headline3': + $row['data'] = str_replace( + "\\\n", + '', + $row['data'] + ); $htmlRow = $row; $htmlRow['data'] = preg_replace_callback( '/\[.*\]/mU', @@ -320,6 +326,9 @@ class MailUtility $textView->assign('content', $bodydataText); $htmlView->assign('content', $bodydataHtml); $domain = $settings['mailDomain']; + if ($assetDomain) { + $domain = $assetDomain; + } $htmlView->assign('domain', $domain); $textBody = $textView->render(); $htmlBody = $htmlView->render(); @@ -329,6 +338,11 @@ class MailUtility 'src="' . $domain . '/assets', $htmlBody ); + $htmlBody = str_replace( + 'src="/public', + 'src="' . $domain . '/public', + $htmlBody + ); } if (version_compare(TYPO3_branch, '10.0', '>=')) { $mail->html($htmlBody);