[TASK] Improve content handling of mailutility

This commit is contained in:
Philipp Dieter 2022-02-22 17:56:17 +01:00
parent 039738d8a3
commit 1e69ff8a25

View File

@ -132,7 +132,8 @@ class MailUtility
$data, $data,
$templateNameHtml = null, $templateNameHtml = null,
$templateNameText = null, $templateNameText = null,
$templatePaths = null $templatePaths = null,
$assetDomain = null
) { ) {
if (!$templateNameHtml) { if (!$templateNameHtml) {
$templateNameHtml = 'Mails/DefaultHtml'; $templateNameHtml = 'Mails/DefaultHtml';
@ -194,6 +195,11 @@ class MailUtility
case 'headline': case 'headline':
case 'headline2': case 'headline2':
case 'headline3': case 'headline3':
$row['data'] = str_replace(
"\\\n",
'',
$row['data']
);
$htmlRow = $row; $htmlRow = $row;
$htmlRow['data'] = preg_replace_callback( $htmlRow['data'] = preg_replace_callback(
'/\[.*\]/mU', '/\[.*\]/mU',
@ -320,6 +326,9 @@ class MailUtility
$textView->assign('content', $bodydataText); $textView->assign('content', $bodydataText);
$htmlView->assign('content', $bodydataHtml); $htmlView->assign('content', $bodydataHtml);
$domain = $settings['mailDomain']; $domain = $settings['mailDomain'];
if ($assetDomain) {
$domain = $assetDomain;
}
$htmlView->assign('domain', $domain); $htmlView->assign('domain', $domain);
$textBody = $textView->render(); $textBody = $textView->render();
$htmlBody = $htmlView->render(); $htmlBody = $htmlView->render();
@ -329,6 +338,11 @@ class MailUtility
'src="' . $domain . '/assets', 'src="' . $domain . '/assets',
$htmlBody $htmlBody
); );
$htmlBody = str_replace(
'src="/public',
'src="' . $domain . '/public',
$htmlBody
);
} }
if (version_compare(TYPO3_branch, '10.0', '>=')) { if (version_compare(TYPO3_branch, '10.0', '>=')) {
$mail->html($htmlBody); $mail->html($htmlBody);