Commit 918ba1bc authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Adding Priority to mail service

parent 87af1e16
......@@ -5,7 +5,6 @@ namespace SGalinski\SgMail\Service;
use SGalinski\SgMail\Domain\Model\Mail;
use SGalinski\SgMail\Domain\Model\Template;
use SGalinski\SgMail\Domain\Repository\MailRepository;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
......@@ -112,6 +111,11 @@ class MailTemplateService {
*/
private $bccAddresses = [];
/**
* @var int
*/
private $priority = Mail::PRIORITY_LOWEST;
/**
* @var \SGalinski\SgMail\Domain\Repository\TemplateRepository
* @inject
......@@ -225,7 +229,7 @@ class MailTemplateService {
$this->mailMessage->setBody($emailBody, 'text/html');
$this->mailMessage->send();
} else {
$this->addMailToMailQueue($emailBody);
$this->addMailToMailQueue($emailBody, $this->priority);
}
return TRUE;
......@@ -238,7 +242,7 @@ class MailTemplateService {
* @param int $priority
* @param int $pid
*/
private function addMailToMailQueue($emailBody, $priority = Mail::PRIORITY_LOWEST, $pid = 0) {
private function addMailToMailQueue($emailBody, $priority, $pid = 0) {
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
......@@ -371,4 +375,14 @@ class MailTemplateService {
return $this;
}
/**
* @param int $priority
* @return MailTemplateService
*/
public function setPriority($priority) {
$this->priority = $priority;
return $this;
}
}
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