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
c5a11509
Commit
c5a11509
authored
Sep 20, 2016
by
Fabian Galinski
😾
Browse files
[TASK] Fixing of the domain models
parent
6ca3110c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/MailController.php
View file @
c5a11509
...
...
@@ -220,12 +220,12 @@ class MailController extends ActionController {
// @todo Die "From email" sollte eine TypoScript-Konfiguration sein.
MailTemplateService
::
sendEmail
(
$selectedLanguageLeft
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
'test@sgmail.de'
,
'This is just a Test E-Mail'
'This is just a Test E-Mail'
,
[],
TRUE
);
MailTemplateService
::
sendEmail
(
$selectedLanguageRight
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
'test@sgmail.de'
,
'This is just a Test E-Mail'
'This is just a Test E-Mail'
,
[],
TRUE
);
// @todo SgMail -> sg_mail | Evtl. kein Fehler, da TYPO3 das für dich macht :)
...
...
Classes/Domain/Model/Mail.php
View file @
c5a11509
...
...
@@ -42,22 +42,22 @@ class Mail extends AbstractEntity {
/**
* @var string
*/
protected
$mail
_s
ubject
=
''
;
protected
$mail
S
ubject
=
''
;
/**
* @var string
*/
protected
$mail
_b
ody
=
''
;
protected
$mail
B
ody
=
''
;
/**
* @var string
*/
protected
$to
_a
ddress
=
''
;
protected
$to
A
ddress
=
''
;
/**
* @var string
*/
protected
$from
_a
ddress
=
''
;
protected
$from
A
ddress
=
''
;
/**
* @var bool
...
...
@@ -73,60 +73,60 @@ class Mail extends AbstractEntity {
* @return string
*/
public
function
getMailSubject
()
{
return
$this
->
mail
_s
ubject
;
return
$this
->
mail
S
ubject
;
}
/**
* @param string $mail
_s
ubject
* @param string $mail
S
ubject
* @return void
*/
public
function
setMailSubject
(
$mail
_s
ubject
)
{
$this
->
mail
_s
ubject
=
$mail
_s
ubject
;
public
function
setMailSubject
(
$mail
S
ubject
)
{
$this
->
mail
S
ubject
=
$mail
S
ubject
;
}
/**
* @return string
*/
public
function
getMailBody
()
{
return
$this
->
mail
_b
ody
;
return
$this
->
mail
B
ody
;
}
/**
* @param string $mail
_b
ody
* @param string $mail
B
ody
* @return void
*/
public
function
setMailBody
(
$mail
_b
ody
)
{
$this
->
mail
_b
ody
=
$mail
_b
ody
;
public
function
setMailBody
(
$mail
B
ody
)
{
$this
->
mail
B
ody
=
$mail
B
ody
;
}
/**
* @return string
*/
public
function
getToAddress
()
{
return
$this
->
to
_a
ddress
;
return
$this
->
to
A
ddress
;
}
/**
* @param string $to
_a
ddress
* @param string $to
A
ddress
* @return void
*/
public
function
setToAddress
(
$to
_a
ddress
)
{
$this
->
to
_a
ddress
=
$to
_a
ddress
;
public
function
setToAddress
(
$to
A
ddress
)
{
$this
->
to
A
ddress
=
$to
A
ddress
;
}
/**
* @return string
*/
public
function
getFromAddress
()
{
return
$this
->
from
_a
ddress
;
return
$this
->
from
A
ddress
;
}
/**
* @param string $from
_a
ddress
* @param string $from
A
ddress
* @return void
*/
public
function
setFromAddress
(
$from
_a
ddress
)
{
$this
->
from
_a
ddress
=
$from
_a
ddress
;
public
function
setFromAddress
(
$from
A
ddress
)
{
$this
->
from
A
ddress
=
$from
A
ddress
;
}
/**
...
...
Classes/Service/MailTemplateService.php
View file @
c5a11509
...
...
@@ -4,6 +4,7 @@ namespace SGalinski\SgMail\Service;
use
SGalinski\SgMail\Domain\Model\Mail
;
use
SGalinski\SgMail\Domain\Repository\MailRepository
;
use
TYPO3\CMS\Core\Mail\MailMessage
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
...
...
@@ -86,9 +87,11 @@ class MailTemplateService {
* @param string $fromAddress
* @param string $subject
* @param string $content
* @param boolean $ignoreMailQueue
*/
public
static
function
sendEmail
(
$language
,
$templateKey
,
$extensionKey
,
$toAddress
,
$fromAddress
,
$subject
,
array
$content
=
[]
$language
,
$templateKey
,
$extensionKey
,
$toAddress
,
$fromAddress
,
$subject
,
array
$content
=
[],
$ignoreMailQueue
=
FALSE
)
{
// Set Email Content
$registerArray
=
MailTemplateService
::
getRegisterArray
();
...
...
@@ -101,8 +104,17 @@ class MailTemplateService {
$emailView
->
assignMultiple
(
$content
);
$emailBody
=
$emailView
->
render
();
// @todo evtl. sollten hier noch die Parameter $priority und $pid mit gegeben werden.
self
::
addMailToMailQueue
(
$fromAddress
,
$toAddress
,
$subject
,
$emailBody
);
if
(
$ignoreMailQueue
)
{
$mailMessage
=
$objectManager
->
get
(
MailMessage
::
class
);
$mailMessage
->
setFrom
(
$fromAddress
);
$mailMessage
->
setTo
(
$toAddress
);
$mailMessage
->
setSubject
(
$subject
);
$mailMessage
->
setBody
(
$emailBody
,
'text/html'
);
$mailMessage
->
send
();
}
else
{
// @todo evtl. sollten hier noch die Parameter $priority und $pid mit gegeben werden.
self
::
addMailToMailQueue
(
$fromAddress
,
$toAddress
,
$subject
,
$emailBody
);
}
}
/**
...
...
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