Hallo,

ich habe diese Funktion bei mir im eine eigene Extension benutzt und so funktioniert!!


/**
* @param array $recipient recipient of the email in the format array('recipi...@domain.tld' => 'Recipient Name') * @param array $sender sender of the email in the format array('sen...@domain.tld' => 'Sender Name')
     * @param string $subject subject of the email
     * @param string $templateName template name (UpperCamelCase)
     * @param array $variables variables to be passed to the Fluid view
     * @return boolean TRUE on success, otherwise false
    */
protected function sendTemplateEmail(array $recipient, array $sender, $subject, $templateName, array $variables = array()) { //$currentContentObject = $this->configurationManager->getContentObject()->data;
        /** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailView */
$emailView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');

$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']);


        # Mailseden = überschreiben mit de korrekte Dir!!!!
$templatePathAndFilename = $templateRootPath . 'Mailseden/' . $templateName . '.html';

$this->view->setTemplatePathAndFilename($templatePathAndFilename);

        $this->view->assignMultiple($variables);
        $emailBody = $this->view->render();

        /** @var $message \TYPO3\CMS\Core\Mail\MailMessage */
$message = $this->objectManager->get('TYPO3\\CMS\\Core\\Mail\\MailMessage');
        $message->setTo($recipient)
              ->setFrom($sender)
              ->setSubject($subject);

         // Possible attachments here
        //foreach ($attachments as $attachment) {
        // $message->attach(\Swift_Attachment::fromPath($attachment));
        //}

        // Plain text example
        $message->setBody($emailBody, 'text/plain');

        // HTML Email
        #$message->setBody($emailBody, 'text/html');

        $message->send();
        return $message->isSent();
    }


$theReturn = $this->sendTemplateEmail(array('nicolas.pue...@lgb-rlp.de' => 'Recipient Name'), array('nicolas.pue...@lgb-rlp.de' => 'Sender Name'), 'Email Subject', 'List', array('someVariable' => 'Foo Bar'));

Viele Grüße.

Nicolas
_______________________________________________
TYPO3-german mailing list
TYPO3-german@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

Antwort per Email an