Commit 4da4951d authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Respect blacklisted field when sending

parent d228948e
......@@ -341,7 +341,9 @@ class MailTemplateService {
// insert <br /> tags, but replace every instance of three or more successive breaks with just two.
$emailBody = nl2br($emailBody);
$emailBody = preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br /><br />', $emailBody);
if ($this->ignoreMailQueue) {
if ($this->ignoreMailQueue && self::isTemplateBlacklisted(
$this->extensionKey, $this->templateName, $siteRootId
)) {
$this->mailMessage->setBody($emailBody, 'text/html');
$this->mailMessage->send();
......@@ -379,7 +381,10 @@ class MailTemplateService {
* @param int $lastSendingTime
* @param string $language
* @param int $pid
* @throws \InvalidArgumentException
* @throws \BadFunctionCallException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
private function addMailToMailQueue(
$extensionKey, $templateName, $subject, $emailBody, $priority, $sendingTime = 0,
......@@ -390,6 +395,7 @@ class MailTemplateService {
$mail->setExtensionKey($extensionKey);
$mail->setTemplateName($templateName);
$mail->setLanguage($language);
$mail->setIsBlacklisted(self::isTemplateBlacklisted($extensionKey, $templateName, $pid));
$mail->setFromAddress($this->fromAddress);
$mail->setFromName($this->fromName);
......@@ -421,7 +427,7 @@ class MailTemplateService {
/** @var Mail $mailToSend */
$mailToSend = $mailRepository->findOneByUid($uid);
if ($mailToSend) {
if ($mailToSend && !$mailToSend->isBlacklisted()) {
$this->mailMessage->setBody($mailToSend->getMailBody(), 'text/html');
$this->mailMessage->setTo(trim($mailToSend->getToAddress()));
$this->mailMessage->setFrom($mailToSend->getFromAddress(), $mailToSend->getFromName());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment