private function sendMail($from, $to, $data, $templateFile) { $template = new \TYPO3\Fluid\View\StandaloneView(); $template->setFormat('html'); $template->setTemplatePathAndFilename('resource://DRKTettnang.Homepage/Private/Templates/Mail/' . $templateFile . '.html'); $template->setPartialRootPath('resource://DRKTettnang.Homepage/Private/Partials/'); $template->assign('data', $data); $subject = trim($template->renderSection('subject')); $html = $template->render(); $body = trim($template->renderSection('body')); $html2text = new \DRKTettnang\Homepage\Vendor\Html2Text($body); $plain = $html2text->getText(); $mail = new \TYPO3\SwiftMailer\Message(); $mail->setTo($to); $mail->setFrom($from); $mail->setSubject($subject); $mail->addPart($html, 'text/html', 'utf-8'); $mail->addPart($plain, 'text/plain', 'utf-8'); $mail->send(); $this->systemLogger->log('Sent mail to ' . $to, LOG_INFO); }