Skip to content
Snippets Groups Projects
Commit ff9adcf1 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

Merge branch 'master' of gitlab.sgalinski.de:typo3/sg_mail into HEAD

parents 9b55167b 9aaf1728
No related branches found
No related tags found
No related merge requests found
...@@ -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
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment