Feature #71982
Updated by Björn Jacob almost 9 years ago
To enable the recipient to have a selection list for email, it's necessary to modify th setTo() function. And and a recipientEmailField in TypoScript with a controller treatment based on setFrom() function. <pre> <code class="php"> typo3/sysext/form/Classes/PostProcess/MailPostProcessor.php (l 169) /** * Adds the receiver of the mail message when configured * * Checks the address if it is a valid email address * * @return void */ protected function setTo() { $toEmails = ''; if ($this->typoScript['recipientEmail']) { $toEmails = $this->typoScript['recipientEmail']; } elseif ($this->requestHandler->has($this->typoScript['recipientEmailField'])) { $toEmails = $this->requestHandler->get($this->typoScript['recipientEmailField']); } else { $toEmails = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']; } if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($toEmails)) { $toEmails = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress(); } $validEmails = $this->filterValidEmails($toEmails); if (count($validEmails)) { $this->mailMessage->setTo($validEmails); } } </code> </pre>