Commit 18a735a6 authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[BUGFIX] Fix more issues with the mail queue

parent 80a80984
......@@ -151,11 +151,11 @@ class MailTemplateService {
}
}
if (sizeof($this->bccAddresses) > 0) {
if (count($this->bccAddresses) > 0) {
$this->mailMessage->setBcc($this->bccAddresses);
}
if (sizeof($this->ccAddresses) > 0) {
if (count($this->ccAddresses) > 0) {
$this->mailMessage->setCc($this->ccAddresses);
}
}
......@@ -214,6 +214,7 @@ class MailTemplateService {
// no language found and no default template
$this->setLanguage('en');
$this->sendEmail();
return TRUE;
}
}
......@@ -233,13 +234,12 @@ class MailTemplateService {
if (!isset($defaultTemplateContent)) {
$emailView->setTemplateSource($template->getContent());
$this->mailMessage->setSubject($template->getSubject());
$subject = $template->getSubject();
} else {
$emailView->setTemplateSource($defaultTemplateContent);
$this->mailMessage->setSubject(
self::$registerArray[$this->extensionKey][$this->templateName]['subjects'][$this->language]
);
$subject = self::$registerArray[$this->extensionKey][$this->templateName]['subjects'][$this->language];
}
$this->mailMessage->setSubject($subject);
$emailView->assignMultiple($this->markers);
$emailBody = $emailView->render();
......@@ -252,7 +252,7 @@ class MailTemplateService {
$this->mailMessage->setBody($emailBody, 'text/html');
$this->mailMessage->send();
} else {
$this->addMailToMailQueue($emailBody, $this->priority);
$this->addMailToMailQueue($subject, $emailBody, $this->priority);
}
return TRUE;
......@@ -261,17 +261,18 @@ class MailTemplateService {
/**
* Adds a new mail to the mail queue.
*
* @param string $subject
* @param string $emailBody
* @param int $priority
*/
private function addMailToMailQueue($emailBody, $priority) {
private function addMailToMailQueue($subject, $emailBody, $priority) {
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$mail = $objectManager->get(Mail::class);
$mail->setFromAddress($this->fromAddress);
$mail->setToAddress($this->toAddresses);
$mail->setMailSubject($this->subject);
$mail->setMailSubject($subject);
$mail->setMailBody($emailBody);
$mail->setPriority($priority);
$mail->setBccAddresses(implode(',', $this->bccAddresses));
......
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