Skip to content

Commit

Permalink
Merge pull request #11 from nitsan-technologies/email-bug-fix
Browse files Browse the repository at this point in the history
Email bug fix
  • Loading branch information
nitsan-technologies committed Oct 5, 2022
2 parents 1891f6f + 7a39083 commit c549f61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
19 changes: 12 additions & 7 deletions Classes/Controller/NsguestbookController.php
Expand Up @@ -81,6 +81,7 @@ public function newAction()
$GLOBALS['TSFE']->additionalFooterData[$this->request->getControllerExtensionKey()] .= "
<script src='https://www.google.com/recaptcha/api.js' type='text/javascript'></script>";
}
$request['tx_nsguestbook_form']['newNsguestbook'] = isset($request['tx_nsguestbook_form']['newNsguestbook']) ? $request['tx_nsguestbook_form']['newNsguestbook'] : '';
$this->view->assign('nsguestbookdata', $request['tx_nsguestbook_form']['newNsguestbook']);
}

Expand Down Expand Up @@ -112,6 +113,7 @@ public function createAction(\Nitsan\NsGuestbook\Domain\Model\Nsguestbook $newNs
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
}
$captcha = isset($captcha) ? $captcha : '';
if (!$captcha && $settings['captcha'] == 0) {
$checkcaptchamsg = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
'controller.checkcaptcha.msg',
Expand Down Expand Up @@ -189,13 +191,16 @@ public function createAction(\Nitsan\NsGuestbook\Domain\Model\Nsguestbook $newNs
$emailSubject = $this->settings['emailSubject'];

$confirmationVariables = ['guest' => $confirmationContent];
$sendSenderMail = $this->sendTemplateEmail(
[$adminEmail => $adminName],
[$adminEmail => $adminName],
$emailSubject,
'MailTemplate',
$confirmationVariables
);

if(filter_var($adminEmail, FILTER_VALIDATE_EMAIL) == TRUE){
$sendSenderMail = $this->sendTemplateEmail(
[$adminEmail => $adminName],
[$adminEmail => $adminName],
$emailSubject,
'MailTemplate',
$confirmationVariables
);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Configuration/FlexForm/flexform.xml
Expand Up @@ -44,7 +44,7 @@
<config>
<type>input</type>
<size>40</size>
<eval>trim,email,required</eval>
<eval>trim,required</eval>
</config>
</TCEforms>
</settings.adminName>
Expand All @@ -55,7 +55,7 @@
<config>
<type>input</type>
<size>40</size>
<eval>trim,required</eval>
<eval>trim,email,required</eval>
</config>
</TCEforms>
</settings.adminEmail>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Expand Up @@ -12,7 +12,7 @@
'uploadfolder' => '0',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '3.2.1',
'version' => '3.2.2',
'constraints' => [
'depends' => [
'typo3' => '6.0.0-11.5.99',
Expand Down

0 comments on commit c549f61

Please sign in to comment.