Commit 04ce82e2 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Refactoring Formhandler Finisher for new Service API

parent fefdc1a1
......@@ -69,14 +69,19 @@ class FormhandlerFinisherService extends AbstractFinisher {
$toAddress = $this->gp['email'];
}
$language = $GLOBALS['TSFE']->config['config']['language'];
$fromAddress = [$this->settings['from_address'] => $this->settings['from_name']];
MailTemplateService::sendEmail(
$language, $this->settings['template_key'], $this->settings['extension_key'], [$toAddress],
$fromAddress, $subject, $this->gp,
$this->settings['ignore_mail_queue']
);
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var \SGalinski\SgMail\Service\MailTemplateService $mailTemplateService */
$mailTemplateService = $objectManager->get(MailTemplateService::class);
$mailTemplateService->setTo($toAddress);
$mailTemplateService->setFrom($fromAddress);
$mailTemplateService->setSubject($subject);
$mailTemplateService->setTemplateName($this->settings['template_key']);
$mailTemplateService->setExtensionKey($this->settings['extension_key']);
$mailTemplateService->setContent($this->gp);
$mailTemplateService->sendEmail();
return $this->gp;
}
......
......@@ -285,4 +285,13 @@ class MailTemplateService {
$this->mailMessage->setSubject($subject);
return $this;
}
/**
* @param array $content
* @return MailTemplateService
*/
public function setContent($content) {
$this->content = $content;
return $this;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment