Classes/Controller/AddressController.php
protected function sendResponseMail( $recipientmails = '', $templateName, array $data = NULL, $type = self::MAILFORMAT_TXT, $subjectSuffix = '' )
    {
        $oldSpamProtectSetting = $GLOBALS['TSFE']->spamProtectEmailAddresses;
        // disable spamProtectEmailAddresses setting for e-mails
        $GLOBALS['TSFE']->spamProtectEmailAddresses = 0;

        $recipients = explode(',', $recipientmails);

        $from = [$this->settings['sendermail'] => $this->settings['sendername']];
        $subject = $this->settings['responseSubject'];

        // add suffix to subject if set
        if ($subjectSuffix != '') {
            $subject .= ' - ' . $subjectSuffix;
        }

        $mailHtml = '';
        $mailText = '';

        switch ($type) {
            case self::MAILFORMAT_TXT:
                $mailTextView = $this->getPlainRenderer($templateName, 'txt');
                break;
            case self::MAILFORMAT_HTML:
                $mailHtmlView = $this->getPlainRenderer($templateName, 'html');
                break;

            /** @noinspection PhpMissingBreakStatementInspection */
            case self::MAILFORMAT_TXTHTML:
                $mailHtmlView = $this->getPlainRenderer($templateName, 'html');
            default:
                $mailTextView = $this->getPlainRenderer($templateName, 'txt');
                break;
        }

        if (isset($mailTextView)) {
            $mailTextView->assignMultiple($data);
            $mailText = $mailTextView->render();
        }
        if (isset($mailHtmlView)) {
            $mailHtmlView->assignMultiple($data);
            $mailHtml = $mailHtmlView->render();
        }

        foreach ($recipients as $recipient) {
            $recipientMail = [trim($recipient)];
            $this->sendEmail(
                $recipientMail,
                $from,
                $subject,
                $mailHtml,
                $mailText
            );
        }

        // revert spamProtectSettings
        $GLOBALS['TSFE']->spamProtectEmailAddresses = $oldSpamProtectSetting;
    }
protected function sendResponseMail( $recipientmails = '', $templateName, array $data = NULL, $type = self::MAILFORMAT_TXT, $subjectSuffix = '' )
    {
        $oldSpamProtectSetting = $GLOBALS['TSFE']->spamProtectEmailAddresses;
        // disable spamProtectEmailAddresses setting for e-mails
        $GLOBALS['TSFE']->spamProtectEmailAddresses = 0;

        $recipients = explode(',', $recipientmails);

        $from = [$this->settings['sendermail'] => $this->settings['sendername']];
        $subject = $this->settings['responseSubject'];

        // add suffix to subject if set
        if ($subjectSuffix != '') {
            $subject .= ' - ' . $subjectSuffix;
        }

        $mailHtml = '';
        $mailText = '';

        switch ($type) {
            case self::MAILFORMAT_TXT:
                $mailTextView = $this->getPlainRenderer($templateName, 'txt');
                break;
            case self::MAILFORMAT_HTML:
                $mailHtmlView = $this->getPlainRenderer($templateName, 'html');
                break;

            /** @noinspection PhpMissingBreakStatementInspection */
            case self::MAILFORMAT_TXTHTML:
                $mailHtmlView = $this->getPlainRenderer($templateName, 'html');
            default:
                $mailTextView = $this->getPlainRenderer($templateName, 'txt');
                break;
        }

        if (isset($mailTextView)) {
            $mailTextView->assignMultiple($data);
            $mailText = $mailTextView->render();
        }
        if (isset($mailHtmlView)) {
            $mailHtmlView->assignMultiple($data);
            $mailHtml = $mailHtmlView->render();
        }

        foreach ($recipients as $recipient) {
            $recipientMail = [trim($recipient)];
            $this->sendEmail(
                $recipientMail,
                $from,
                $subject,
                $mailHtml,
                $mailText
            );
        }

        // revert spamProtectSettings
        $GLOBALS['TSFE']->spamProtectEmailAddresses = $oldSpamProtectSetting;
    }
protected function sendResponseMail ( $ recipientmails = '' , $ templateName , array $ data = NULL , $ type = self :: MAILFORMAT_TXT , $ subjectSuffix = '' ) { $ oldSpamProtectSetting = $ GLOBALS [ 'TSFE' ] -> spamProtectEmailAddresses ; // disable spamProtectEmailAddresses setting for e-mails $ GLOBALS [ 'TSFE' ] -> spamProtectEmailAddresses = 0 ; $ recipients = explode ( ',' , $ recipientmails ) ; $ from = [ $ this -> settings [ 'sendermail' ] => $ this -> settings [ 'sendername' ] ] ; $ subject = $ this -> settings [ 'responseSubject' ] ; // add suffix to subject if set if ( $ subjectSuffix != '' ) { $ subject .= ' - ' . $ subjectSuffix ; } $ mailHtml = '' ; $ mailText = '' ; switch ( $ type ) { case self :: MAILFORMAT_TXT : $ mailTextView = $ this -> getPlainRenderer ( $ templateName , 'txt' ) ; break ; case self :: MAILFORMAT_HTML : $ mailHtmlView = $ this -> getPlainRenderer ( $ templateName , 'html' ) ; break ; /** @noinspection PhpMissingBreakStatementInspection */ case self :: MAILFORMAT_TXTHTML : $ mailHtmlView = $ this -> getPlainRenderer ( $ templateName , 'html' ) ; default : $ mailTextView = $ this -> getPlainRenderer ( $ templateName , 'txt' ) ; break ; } if ( isset ( $ mailTextView ) ) { $ mailTextView -> assignMultiple ( $ data ) ; $ mailText = $ mailTextView -> render ( ) ; } if ( isset ( $ mailHtmlView ) ) { $ mailHtmlView -> assignMultiple ( $ data ) ; $ mailHtml = $ mailHtmlView -> render ( ) ; } foreach ( $ recipients as $ recipient ) { $ recipientMail = [ trim ( $ recipient ) ] ; $ this -> sendEmail ( $ recipientMail , $ from , $ subject , $ mailHtml , $ mailText ) ; } // revert spamProtectSettings $ GLOBALS [ 'TSFE' ] -> spamProtectEmailAddresses = $ oldSpamProtectSetting ; }
sends an e-mail to users
@param string $recipientmails
@param string $templateName
@param array $data
@param string $type
@param string $subjectSuffix
@return void
@throws \InvalidArgumentException
@throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException
sends an e - mail to users