Skip to content
GitLab
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
973daa40
Commit
973daa40
authored
Feb 16, 2017
by
Torsten Oppermann
Browse files
[TASK] Adding method to use predefined values for the new fields
parent
1593f6e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Service/MailTemplateService.php
View file @
973daa40
...
...
@@ -259,6 +259,32 @@ class MailTemplateService {
return
self
::
$registerArray
;
}
/**
* Sets the predefined values for this template, supplied by the Editor, if possible
* values for cc, bcc, replyTo, fromMail and fromName
*
* @param string $extensionKey
* @param string $templateName
* @param string $language
* @return bool
*/
public
function
loadPredefinedValuesForTemplate
(
$extensionKey
,
$templateName
,
$language
)
{
/** @var Template $template */
$template
=
$this
->
templateRepository
->
findOneByTemplate
(
$this
->
extensionKey
,
$this
->
templateName
,
$this
->
language
);
if
(
$template
!==
NULL
)
{
$this
->
setCcAddresses
(
explode
(
','
,
$template
->
getCc
()));
$this
->
setBccAddresses
(
explode
(
','
,
$template
->
getBcc
()));
$this
->
setReplyToAddress
(
$template
->
getReplyTo
());
$this
->
setFromAddress
(
$template
->
getFromMail
(),
$template
->
getFromName
());
return
true
;
}
return
false
;
}
/**
* Send the Email
*
...
...
@@ -389,11 +415,12 @@ class MailTemplateService {
/**
* @param string $fromAddress
* @param string $fromName
* @return MailTemplateService
*/
public
function
setFromAddress
(
$fromAddress
)
{
public
function
setFromAddress
(
$fromAddress
,
$fromName
=
''
)
{
$this
->
fromAddress
=
$fromAddress
;
$this
->
mailMessage
->
setFrom
(
$fromAddress
);
$this
->
mailMessage
->
setFrom
(
$fromAddress
,
$fromName
);
return
$this
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment