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
748cad6b
Commit
748cad6b
authored
Mar 03, 2020
by
Georgi Mateev
Browse files
[BUGFIX] 1584 Removed unnecessary complex logic from the Newsletter and SendEmail
parent
a2711427
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Service/MailTemplateService.php
View file @
748cad6b
...
...
@@ -828,15 +828,16 @@ class MailTemplateService {
* @param boolean $isNewsletter
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
protected
function
extract
ValuesForMail
(
protected
function
parse
ValuesForMail
(
$template
,
RegisterService
$registerService
,
$defaultTemplateContent
,
$siteRootId
,
$isNewsletter
$siteRootId
):
void
{
/** @var StandaloneView $emailView */
$emailView
=
$this
->
objectManager
->
get
(
StandaloneView
::
class
);
$emailView
->
assignMultiple
(
$this
->
markers
);
$emailView
->
assign
(
'all_fields'
,
$this
->
getAllMarker
(
$this
->
markers
));
//TODO: make this as the lines below the next block
$overwrittenEmailBody
=
$this
->
getOverwrittenEmailBody
();
$overwrittenSubject
=
''
;
if
(
$this
->
subject
!==
''
&&
$this
->
subject
!==
NULL
)
{
...
...
@@ -875,57 +876,27 @@ class MailTemplateService {
// Parse the markers
if
(
$this
->
fromName
)
{
$this
->
setFromName
(
$this
->
parseMarkers
(
$this
->
fromName
,
$emailView
)
);
$this
->
setFromName
(
$this
->
parseMarkers
(
$this
->
fromName
,
$emailView
));
}
if
(
$this
->
fromAddress
)
{
$this
->
setFromAddress
(
$this
->
parseMarkers
(
$this
->
fromAddress
,
$emailView
)
);
$this
->
setFromAddress
(
$this
->
parseMarkers
(
$this
->
fromAddress
,
$emailView
));
}
if
(
$this
->
replyToAddress
)
{
$this
->
setReplyToAddress
(
$this
->
parseMarkers
(
$this
->
replyToAddress
,
$emailView
)
);
$this
->
setReplyToAddress
(
$this
->
parseMarkers
(
$this
->
replyToAddress
,
$emailView
));
}
if
(
$this
->
bccAddresses
)
{
$this
->
setCcAddresses
(
$this
->
parseMarkers
(
$this
->
ccAddresses
,
$emailView
)
);
if
(
$this
->
ccAddresses
)
{
$this
->
setCcAddresses
(
$this
->
parseMarkers
(
$this
->
ccAddresses
,
$emailView
));
}
if
(
$this
->
bccAddresses
)
{
$this
->
setBccAddresses
(
$this
->
parseMarkers
(
$this
->
bccAddresses
,
$emailView
)
);
$this
->
setBccAddresses
(
$this
->
parseMarkers
(
$this
->
bccAddresses
,
$emailView
));
}
if
(
$this
->
toAddresses
)
{
$this
->
setToAddresses
(
$this
->
parseMarkers
(
$this
->
toAddresses
,
$emailView
)
);
$this
->
setToAddresses
(
$this
->
parseMarkers
(
$this
->
toAddresses
,
$emailView
));
}
// reset template source back to default
...
...
@@ -994,12 +965,7 @@ class MailTemplateService {
$this
->
setToAddresses
(
\
trim
(
$template
->
getToAddress
()));
}
$this
->
extractValuesForMail
(
$template
,
$registerService
,
$defaultTemplateContent
,
$siteRootId
,
$isNewsletter
);
// Fallback empty recipient address to the default sender address
if
(
!
$this
->
mailMessage
->
getTo
())
{
$this
->
mailMessage
->
setTo
(
$this
->
defaultFromAddress
);
}
$this
->
parseValuesForMail
(
$template
,
$registerService
,
$defaultTemplateContent
,
$siteRootId
);
$mail
=
$this
->
addMailToMailQueue
(
$this
->
extensionKey
,
$this
->
templateName
,
$this
->
getSubjectToSend
(),
$this
->
getMailBodyToSend
(),
...
...
@@ -1308,7 +1274,7 @@ class MailTemplateService {
*
* @param Template $template
*/
private
function
loadTemplateValues
(
$template
):
void
{
private
function
loadTemplateValues
(
Template
$template
):
void
{
$fromName
=
\
trim
(
$template
->
getFromName
());
if
(
$fromName
===
''
)
{
$fromName
=
$this
->
fromName
;
...
...
@@ -1318,6 +1284,7 @@ class MailTemplateService {
}
$fromMail
=
$this
->
getValidFromMail
(
\
trim
(
$template
->
getFromMail
()));
// The setters check if the value is empty or not
$this
->
setFromAddress
(
$fromMail
,
$fromName
);
$this
->
setCcAddresses
(
$template
->
getCc
());
$this
->
setBccAddresses
(
$template
->
getBcc
());
...
...
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