Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_mail
Commits
ff9adcf1
Commit
ff9adcf1
authored
7 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.sgalinski.de:typo3/sg_mail into HEAD
parents
9b55167b
9aaf1728
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Service/MailTemplateService.php
+15
-8
15 additions, 8 deletions
Classes/Service/MailTemplateService.php
with
15 additions
and
8 deletions
Classes/Service/MailTemplateService.php
+
15
−
8
View file @
ff9adcf1
...
@@ -66,7 +66,7 @@ class MailTemplateService {
...
@@ -66,7 +66,7 @@ class MailTemplateService {
/**
/**
* @var array $ccAddresses
* @var array $ccAddresses
*/
*/
private
$ccAddresses
=
[]
;
private
$ccAddresses
;
/**
/**
* @var string $replyToAddress
* @var string $replyToAddress
...
@@ -108,12 +108,12 @@ class MailTemplateService {
...
@@ -108,12 +108,12 @@ class MailTemplateService {
*
*
* @var array $tsSettings
* @var array $tsSettings
*/
*/
private
$tsSettings
=
[]
;
private
$tsSettings
;
/**
/**
* @var array $bccAddresses
* @var array $bccAddresses
*/
*/
private
$bccAddresses
=
[]
;
private
$bccAddresses
;
/**
/**
* @var int
* @var int
...
@@ -147,6 +147,8 @@ class MailTemplateService {
...
@@ -147,6 +147,8 @@ class MailTemplateService {
/**
/**
* MailTemplateService constructor.
* MailTemplateService constructor.
*
* @throws \InvalidArgumentException
*/
*/
public
function
__construct
()
{
public
function
__construct
()
{
/** @var ObjectManager objectManager */
/** @var ObjectManager objectManager */
...
@@ -221,10 +223,11 @@ class MailTemplateService {
...
@@ -221,10 +223,11 @@ class MailTemplateService {
/**
/**
* call in extlocalconf of an extension if you have a custom register class
* call in extlocalconf of an extension if you have a custom register class
*
*
* @param RegisterInterface
* @param RegisterInterface
$fileNameWithNamespace
* @param boolean Should the object initialize itself ?
* @param boolean
$initObject
Should the object initialize itself ?
*
*
* @return bool
* @return bool
* @throws \InvalidArgumentException
*/
*/
public
static
function
registerByFile
(
$fileNameWithNamespace
,
$initObject
=
TRUE
)
{
public
static
function
registerByFile
(
$fileNameWithNamespace
,
$initObject
=
TRUE
)
{
$registerObject
=
GeneralUtility
::
makeInstance
(
$fileNameWithNamespace
);
$registerObject
=
GeneralUtility
::
makeInstance
(
$fileNameWithNamespace
);
...
@@ -331,7 +334,7 @@ class MailTemplateService {
...
@@ -331,7 +334,7 @@ class MailTemplateService {
$defaultTemplateContent
=
file_get_contents
(
$templatePath
.
$this
->
language
.
'.template.html'
);
$defaultTemplateContent
=
file_get_contents
(
$templatePath
.
$this
->
language
.
'.template.html'
);
}
else
{
}
else
{
// no language found and no default template
// no language found and no default template
$this
->
setLanguage
(
'en'
);
$this
->
setLanguage
(
$this
->
tsSettings
[
'templateDefaultLanguage'
]
?:
'en'
);
// does an english default template exist ?
// does an english default template exist ?
if
(
file_exists
(
$templatePath
.
$this
->
language
.
'.template.html'
))
{
if
(
file_exists
(
$templatePath
.
$this
->
language
.
'.template.html'
))
{
$this
->
sendEmail
();
$this
->
sendEmail
();
...
@@ -344,6 +347,7 @@ class MailTemplateService {
...
@@ -344,6 +347,7 @@ class MailTemplateService {
if
(
$isPreview
)
{
if
(
$isPreview
)
{
$previewMarker
=
[];
$previewMarker
=
[];
/** @var array $markerArray */
$markerArray
=
self
::
$registerArray
[
$this
->
extensionKey
][
$this
->
templateName
][
'marker'
];
$markerArray
=
self
::
$registerArray
[
$this
->
extensionKey
][
$this
->
templateName
][
'marker'
];
foreach
(
$markerArray
as
$marker
)
{
foreach
(
$markerArray
as
$marker
)
{
if
(
$marker
[
'backend_translation_key'
])
{
if
(
$marker
[
'backend_translation_key'
])
{
...
@@ -361,7 +365,7 @@ class MailTemplateService {
...
@@ -361,7 +365,7 @@ class MailTemplateService {
/** @var StandaloneView $emailView */
/** @var StandaloneView $emailView */
$emailView
=
$this
->
objectManager
->
get
(
StandaloneView
::
class
);
$emailView
=
$this
->
objectManager
->
get
(
StandaloneView
::
class
);
if
(
!
isset
(
$defaultTemplateContent
)
)
{
if
(
null
===
$defaultTemplateContent
)
{
$emailView
->
setTemplateSource
(
$template
->
getContent
());
$emailView
->
setTemplateSource
(
$template
->
getContent
());
$subject
=
$template
->
getSubject
();
$subject
=
$template
->
getSubject
();
}
else
{
}
else
{
...
@@ -412,6 +416,7 @@ class MailTemplateService {
...
@@ -412,6 +416,7 @@ class MailTemplateService {
* @param int $sendingTime
* @param int $sendingTime
* @param int $priority
* @param int $priority
* @param bool $sent
* @param bool $sent
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
*/
private
function
addMailToMailQueue
(
private
function
addMailToMailQueue
(
$extensionKey
,
$templateName
,
$subject
,
$emailBody
,
$priority
,
$sendingTime
=
0
,
$sent
=
FALSE
$extensionKey
,
$templateName
,
$subject
,
$emailBody
,
$priority
,
$sendingTime
=
0
,
$sent
=
FALSE
...
@@ -440,6 +445,8 @@ class MailTemplateService {
...
@@ -440,6 +445,8 @@ class MailTemplateService {
* Send a Mail from the queue, identified by its id
* Send a Mail from the queue, identified by its id
*
*
* @param int $uid
* @param int $uid
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
*/
public
function
sendMailFromQueue
(
$uid
)
{
public
function
sendMailFromQueue
(
$uid
)
{
$mailRepository
=
$this
->
objectManager
->
get
(
MailRepository
::
class
);
$mailRepository
=
$this
->
objectManager
->
get
(
MailRepository
::
class
);
...
@@ -601,7 +608,7 @@ class MailTemplateService {
...
@@ -601,7 +608,7 @@ class MailTemplateService {
/**
/**
* @param Swift_OutputByteStream $data
* @param Swift_OutputByteStream $data
* @param string $
path
* @param string $
filename
* @param string $contentType
* @param string $contentType
* @return MailTemplateService
* @return MailTemplateService
*/
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment