Commit c5a11509 authored by Fabian Galinski's avatar Fabian Galinski 😾
Browse files

[TASK] Fixing of the domain models

parent 6ca3110c
......@@ -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 :)
......
......@@ -42,22 +42,22 @@ class Mail extends AbstractEntity {
/**
* @var string
*/
protected $mail_subject = '';
protected $mailSubject = '';
/**
* @var string
*/
protected $mail_body = '';
protected $mailBody = '';
/**
* @var string
*/
protected $to_address = '';
protected $toAddress = '';
/**
* @var string
*/
protected $from_address = '';
protected $fromAddress = '';
/**
* @var bool
......@@ -73,60 +73,60 @@ class Mail extends AbstractEntity {
* @return string
*/
public function getMailSubject() {
return $this->mail_subject;
return $this->mailSubject;
}
/**
* @param string $mail_subject
* @param string $mailSubject
* @return void
*/
public function setMailSubject($mail_subject) {
$this->mail_subject = $mail_subject;
public function setMailSubject($mailSubject) {
$this->mailSubject = $mailSubject;
}
/**
* @return string
*/
public function getMailBody() {
return $this->mail_body;
return $this->mailBody;
}
/**
* @param string $mail_body
* @param string $mailBody
* @return void
*/
public function setMailBody($mail_body) {
$this->mail_body = $mail_body;
public function setMailBody($mailBody) {
$this->mailBody = $mailBody;
}
/**
* @return string
*/
public function getToAddress() {
return $this->to_address;
return $this->toAddress;
}
/**
* @param string $to_address
* @param string $toAddress
* @return void
*/
public function setToAddress($to_address) {
$this->to_address = $to_address;
public function setToAddress($toAddress) {
$this->toAddress = $toAddress;
}
/**
* @return string
*/
public function getFromAddress() {
return $this->from_address;
return $this->fromAddress;
}
/**
* @param string $from_address
* @param string $fromAddress
* @return void
*/
public function setFromAddress($from_address) {
$this->from_address = $from_address;
public function setFromAddress($fromAddress) {
$this->fromAddress = $fromAddress;
}
/**
......
......@@ -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);
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment