Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
sg_mail
Commits
918ba1bc
Commit
918ba1bc
authored
Oct 02, 2016
by
Torsten Oppermann
Browse files
[TASK] Adding Priority to mail service
parent
87af1e16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Service/MailTemplateService.php
View file @
918ba1bc
...
...
@@ -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
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment