Commit 92ab09a5 authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[BUGFIX] Use default from address as to address to prevent crashes, Add the...

[BUGFIX] Use default from address as to address to prevent crashes, Add the date for the auto-prefilled fields for send forms
parent ae2403b5
......@@ -44,7 +44,6 @@ use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* MailTemplateService
......@@ -980,6 +979,8 @@ class MailTemplateService {
} elseif (\is_bool($value)) {
$valueAsString = $value ? 'true' : 'false';
$allMarker .= $key . ': ' . $valueAsString . PHP_EOL;
} elseif ($value instanceof DateTime) {
$allMarker .= $key . ': ' . $value->format('d.m.Y') . PHP_EOL;
} elseif (\is_object($value)) {
if (\method_exists($value, '__toString')) {
$allMarker .= $key . ': ' . $value->__toString() . PHP_EOL;
......@@ -1014,6 +1015,8 @@ class MailTemplateService {
} elseif (\is_bool($value)) {
$valueAsString = $value ? 'true' : 'false';
$allMarker .= '<tr><th>' . $key . ' </th><td> ' . $valueAsString . '</td></tr>';
} elseif ($value instanceof DateTime) {
$allMarker .= '<tr><th>' . $key . ' </th><td> ' . $value->format('d.m.Y') . '</td></tr>';
} elseif (\is_object($value)) {
if (\method_exists($value, '__toString')) {
$allMarker .= '<tr><th>' . $key . ' </th><td> ' . $value->__toString() . '</td></tr>';
......@@ -1242,7 +1245,16 @@ class MailTemplateService {
$toAddresses = $addressesArray;
}
$this->mailMessage->setTo($toAddresses);
if ($toAddresses === '') {
if (\filter_var($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'], FILTER_VALIDATE_EMAIL)) {
$this->mailMessage->setTo($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']);
} else {
return FALSE;
}
} else {
$this->mailMessage->setTo($toAddresses);
}
$this->mailMessage->setFrom($mailToSend->getFromAddress(), $mailToSend->getFromName());
$this->mailMessage->setSubject($mailToSend->getMailSubject());
if ($mailToSend->getBccAddresses()) {
......
Markdown is supported
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