[TASK] Work on compatibility for TYPO3 11
This commit is contained in:
parent
d66fdf29a1
commit
5c42fa2d1d
@ -20,6 +20,7 @@ use TYPO3\CMS\Extbase\Service\ImageService;
|
|||||||
use TYPO3\CMS\Fluid\View\StandaloneView;
|
use TYPO3\CMS\Fluid\View\StandaloneView;
|
||||||
use TYPO3\CMS\Fluid\View\TemplatePaths;
|
use TYPO3\CMS\Fluid\View\TemplatePaths;
|
||||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||||
|
use Symfony\Component\Mime\Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -219,8 +220,13 @@ class MailUtility
|
|||||||
}
|
}
|
||||||
$textView->setTemplate($templateNameText);
|
$textView->setTemplate($templateNameText);
|
||||||
$mail = GeneralUtility::makeInstance(MailMessage::class);
|
$mail = GeneralUtility::makeInstance(MailMessage::class);
|
||||||
$mail->setFrom($sender);
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
$mail->setSubject($subject);
|
$mail->from(new Address($sender));
|
||||||
|
$mail->subject($subject);
|
||||||
|
} else {
|
||||||
|
$mail->setFrom($sender);
|
||||||
|
$mail->setSubject($subject);
|
||||||
|
}
|
||||||
$bodydataText = [];
|
$bodydataText = [];
|
||||||
$bodydataHtml = [];
|
$bodydataHtml = [];
|
||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
@ -320,11 +326,19 @@ class MailUtility
|
|||||||
$bodydataHtml[] = $htmlRow;
|
$bodydataHtml[] = $htmlRow;
|
||||||
break;
|
break;
|
||||||
case 'attachment':
|
case 'attachment':
|
||||||
$mail->attach(new \Swift_Attachment(
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
$row['data'][0],
|
$mail->attach(
|
||||||
$row['data'][1],
|
$row['data'][0],
|
||||||
$row['data'][2]
|
$row['data'][1],
|
||||||
));
|
$row['data'][2]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$mail->attach(new \Swift_Attachment(
|
||||||
|
$row['data'][0],
|
||||||
|
$row['data'][1],
|
||||||
|
$row['data'][2]
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'attachmentBase64':
|
case 'attachmentBase64':
|
||||||
$attachmentdata = explode(',', $row['data']);
|
$attachmentdata = explode(',', $row['data']);
|
||||||
@ -332,11 +346,19 @@ class MailUtility
|
|||||||
$mimetype = $matches[1];
|
$mimetype = $matches[1];
|
||||||
preg_match('/\w*\/(.*);\w*/', $attachmentdata[0], $matches);
|
preg_match('/\w*\/(.*);\w*/', $attachmentdata[0], $matches);
|
||||||
$fileextension = $matches[1];
|
$fileextension = $matches[1];
|
||||||
$mail->attach(new \Swift_Attachment(
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
base64_decode($attachmentdata[1]),
|
$mail->attach(
|
||||||
'attachment.' . $fileextension,
|
base64_decode($attachmentdata[1]),
|
||||||
$mimetype
|
'attachment.' . $fileextension,
|
||||||
));
|
$mimetype
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$mail->attach(new \Swift_Attachment(
|
||||||
|
base64_decode($attachmentdata[1]),
|
||||||
|
'attachment.' . $fileextension,
|
||||||
|
$mimetype
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,16 +402,27 @@ class MailUtility
|
|||||||
);
|
);
|
||||||
foreach ($recipientsIntercecpted as $recipientIntercepted) {
|
foreach ($recipientsIntercecpted as $recipientIntercepted) {
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
$mail->setSubject(
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
$subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']'
|
$mail->subject(
|
||||||
);
|
$subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']'
|
||||||
$mail->setTo(trim($recipientIntercepted));
|
);
|
||||||
|
$mail->to(new Address(trim($recipientIntercepted)));
|
||||||
|
} else {
|
||||||
|
$mail->setSubject(
|
||||||
|
$subjectOrig . ' [ORIG-TO: ' . trim($recipient) . ']'
|
||||||
|
);
|
||||||
|
$mail->setTo(trim($recipientIntercepted));
|
||||||
|
}
|
||||||
$mail->send();
|
$mail->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
$mail->setTo(trim($recipient));
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
|
$mail->to(new Address(trim($recipient)));
|
||||||
|
} else {
|
||||||
|
$mail->setTo(trim($recipient));
|
||||||
|
}
|
||||||
$mail->send();
|
$mail->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user