Hallo, ich habe deine Antwort gerade gesehen. So habe ich benutzt:
/**
* @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']);
$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();
}
// E-Mail zum Bestellungs beareiter
$thereturn =
$this->sendTemplateEmail(array($this->settings['flexForm']['e_mailBer']
=> 'Recipient Name'), array($this->settings['flexForm']['e_mailBer'] =>
'Sender Name'), 'Bestellung', 'Bestellung', array('someVariable' => 'Foo
Bar'));
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($thereturn,
'thereturn');
// Zum andere bearbeiter
if($this->settings['flexForm']['e_mailLeit']){
$thereturn =
$this->sendTemplateEmail(array($this->settings['flexForm']['e_mailLeit']
=> 'Recipient Name'), array($this->settings['flexForm']['e_mailLeit'] =>
'Sender Name'), 'Bestellung', 'Bestellung', array('someVariable' => 'Foo
Bar'));
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($thereturn,
'thereturn');
}
// E-Mail zum Kunde
$thereturn =
$this->sendTemplateEmail(array($this->settings['flexForm']['e_mailBer']
=> 'Recipient Name'), array($this->settings['flexForm']['e_mailBer'] =>
'Sender Name'), $this->settings['flexForm']['e_betreff'], 'List',
array('someVariable' => 'Foo Bar'));
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($thereturn,
'thereturn');
Ich überschreibe das Template im kontroller im jede anruft!! :
$this->view->setTemplatePathAndFilename($templatePathAndFilename);
Dann habe ich kein Problem mehr.
Viel Grüße
Nicolas
___
TYPO3-german mailing list
TYPO3-german@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german