Skip to content
Snippets Groups Projects
Commit 62cfde25 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Another bunch of fixes. (default mail was never used, form mailing could crash)

parent a02f35f5
No related branches found
No related tags found
No related merge requests found
...@@ -46,12 +46,9 @@ class FormsFinisher extends AbstractFinisher { ...@@ -46,12 +46,9 @@ class FormsFinisher extends AbstractFinisher {
]; ];
/** /**
*
* Send email with the sgmail api to one or more recipients * Send email with the sgmail api to one or more recipients
* overwrites the mail markers with custom identifiers if provided * overwrites the mail markers with custom identifiers if provided
* *
* @see AbstractFinisher::execute()
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \BadFunctionCallException * @throws \BadFunctionCallException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
...@@ -92,8 +89,8 @@ class FormsFinisher extends AbstractFinisher { ...@@ -92,8 +89,8 @@ class FormsFinisher extends AbstractFinisher {
} }
} }
$templateName = trim($this->parseOption('template')); $templateName = trim((string) $this->parseOption('template'));
if ($this->parseOption('template') === '') { if ($templateName === '') {
$templateName = $formDefinition->getIdentifier(); $templateName = $formDefinition->getIdentifier();
} }
...@@ -107,32 +104,32 @@ class FormsFinisher extends AbstractFinisher { ...@@ -107,32 +104,32 @@ class FormsFinisher extends AbstractFinisher {
$mailTemplateService->setIgnoreMailQueue($ignoreMailQueue); $mailTemplateService->setIgnoreMailQueue($ignoreMailQueue);
$mailTemplateService->setLanguage($GLOBALS['TSFE']->config['config']['language']); $mailTemplateService->setLanguage($GLOBALS['TSFE']->config['config']['language']);
$mailToAdresses = trim($this->parseOption('mailTo')); $mailToAdresses = trim((string) $this->parseOption('mailTo'));
if ($mailToAdresses !== '') { if ($mailToAdresses !== '') {
$mailTemplateService->setToAddresses($this->parseOption('mailTo')); $mailTemplateService->setToAddresses($this->parseOption('mailTo'));
} }
$fromAddress = trim($this->parseOption('mailFrom')); $fromAddress = trim((string) $this->parseOption('mailFrom'));
if ($fromAddress !== '') { if ($fromAddress !== '') {
$mailTemplateService->setFromAddress($fromAddress); $mailTemplateService->setFromAddress($fromAddress);
} }
$fromName = trim($this->parseOption('userName')); $fromName = trim((string) $this->parseOption('userName'));
if ($fromName !== '') { if ($fromName !== '') {
$mailTemplateService->setFromName($fromName); $mailTemplateService->setFromName($fromName);
} }
$replyTo = trim($this->parseOption('replyTo')); $replyTo = trim((string) $this->parseOption('replyTo'));
if ($replyTo !== '') { if ($replyTo !== '') {
$mailTemplateService->setReplyToAddress($replyTo); $mailTemplateService->setReplyToAddress($replyTo);
} }
$ccAddresses = trim($this->parseOption('cc')); $ccAddresses = trim((string) $this->parseOption('cc'));
if ($ccAddresses !== '') { if ($ccAddresses !== '') {
$mailTemplateService->setCcAddresses($ccAddresses); $mailTemplateService->setCcAddresses($ccAddresses);
} }
$bccAddresses = trim($this->parseOption('bcc')); $bccAddresses = trim((string) $this->parseOption('bcc'));
if ($bccAddresses !== '') { if ($bccAddresses !== '') {
$mailTemplateService->setBccAddresses($bccAddresses); $mailTemplateService->setBccAddresses($bccAddresses);
} }
......
...@@ -173,7 +173,7 @@ class MailTemplateService { ...@@ -173,7 +173,7 @@ class MailTemplateService {
$this->persistenceManager = $this->objectManager->get(PersistenceManager::class); $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
// use defaultMailFromAddress if it is provided in LocalConfiguration.php; use the sg_mail TS setting as fallback // use defaultMailFromAddress if it is provided in LocalConfiguration.php; use the sg_mail TS setting as fallback
if (!filter_var($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'], FILTER_VALIDATE_EMAIL)) { if (filter_var($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'], FILTER_VALIDATE_EMAIL)) {
$this->fromAddress = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']; $this->fromAddress = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
} else { } else {
$this->fromAddress = $tsSettings['mail']['default']['from']; $this->fromAddress = $tsSettings['mail']['default']['from'];
......
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