diff --git a/Classes/Domain/Service/Mail/SendOptinConfirmationMailPreflight.php b/Classes/Domain/Service/Mail/SendOptinConfirmationMailPreflight.php index ea7d76f45..e0c940d98 100644 --- a/Classes/Domain/Service/Mail/SendOptinConfirmationMailPreflight.php +++ b/Classes/Domain/Service/Mail/SendOptinConfirmationMailPreflight.php @@ -65,6 +65,7 @@ public function __construct(array $settings, array $conf) */ public function sendOptinConfirmationMail(Mail $mail): void { + $senderService = ObjectUtility::getObjectManager()->get(SenderMailPropertiesService::class, $this->settings, $this->conf); $email = [ 'template' => 'Mail/OptinMail', 'receiverEmail' => $this->mailRepository->getSenderMailFromArguments($mail), @@ -72,15 +73,12 @@ public function sendOptinConfirmationMail(Mail $mail): void $mail, [$this->conf['sender.']['default.'], 'senderName'] ), - 'senderEmail' => $this->settings['sender']['email'], - 'senderName' => $this->settings['sender']['name'], - 'replyToEmail' => $this->settings['sender']['email'], - 'replyToName' => $this->settings['sender']['name'], - 'subject' => ObjectUtility::getContentObject()->cObjGetSingle( - $this->conf['optin.']['subject'], - $this->conf['optin.']['subject.'] - ), - 'rteBody' => '', + 'senderEmail' => $senderService->getSenderEmail(), + 'senderName' => $senderService->getSenderName(), + 'replyToEmail' => $senderService->getSenderEmail(), + 'replyToName' => $senderService->getSenderName(), + 'subject' => $senderService->getOptinSubject(), + 'rteBody' => $this->settings['optin']['body'], 'format' => $this->settings['sender']['mailformat'], 'variables' => [ 'hash' => HashUtility::getHash($mail), diff --git a/Classes/Domain/Service/Mail/SendSenderMailPreflight.php b/Classes/Domain/Service/Mail/SendSenderMailPreflight.php index 0d091994a..735994a41 100644 --- a/Classes/Domain/Service/Mail/SendSenderMailPreflight.php +++ b/Classes/Domain/Service/Mail/SendSenderMailPreflight.php @@ -65,7 +65,7 @@ public function __construct(array $settings, array $conf) */ public function sendSenderMail(Mail $mail): void { - $senderService = ObjectUtility::getObjectManager()->get(SenderMailPropertiesService::class, $this->settings); + $senderService = ObjectUtility::getObjectManager()->get(SenderMailPropertiesService::class, $this->settings, $this->conf); $email = [ 'template' => 'Mail/SenderMail', 'receiverEmail' => $this->mailRepository->getSenderMailFromArguments($mail), diff --git a/Classes/Domain/Service/Mail/SenderMailPropertiesService.php b/Classes/Domain/Service/Mail/SenderMailPropertiesService.php index b196d1b96..820d07c0b 100644 --- a/Classes/Domain/Service/Mail/SenderMailPropertiesService.php +++ b/Classes/Domain/Service/Mail/SenderMailPropertiesService.php @@ -35,13 +35,13 @@ class SenderMailPropertiesService /** * @param array $settings + * @param array $configuration * @throws Exception */ - public function __construct(array $settings) + public function __construct(array $settings, array $configuration) { $this->settings = $settings; - $typoScriptService = ObjectUtility::getObjectManager()->get(TypoScriptService::class); - $this->configuration = $typoScriptService->convertPlainArrayToTypoScriptArray($this->settings); + $this->configuration = $configuration; } /** @@ -95,4 +95,28 @@ public function getSenderName(): string $this->signalDispatch(__CLASS__, __FUNCTION__, $signalArguments); return $senderName; } + + /** + * Get optin subject from form settings. If empty, take value from TypoScript. + * + * @return string + * @throws InvalidSlotException + * @throws InvalidSlotReturnException + * @throws Exception + */ + public function getOptinSubject(): string + { + if ($this->settings['optin']['subject'] !== '') { + $optinSubject = $this->settings['optin']['subject']; + } else { + $optinSubject = ObjectUtility::getContentObject()->cObjGetSingle( + $this->configuration['optin.']['subject'], + $this->configuration['optin.']['subject.'] + ); + } + + $signalArguments = [&$optinSubject, $this]; + $this->signalDispatch(__CLASS__, __FUNCTION__, $signalArguments); + return $optinSubject; + } } diff --git a/Configuration/FlexForms/FlexformPi1.xml b/Configuration/FlexForms/FlexformPi1.xml index 71d7faddc..a476d5bd2 100644 --- a/Configuration/FlexForms/FlexformPi1.xml +++ b/Configuration/FlexForms/FlexformPi1.xml @@ -302,6 +302,39 @@ + + + + LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:flexform.optin + + FIELD:main.settings.flexform.main.optin:=:1 + array + + + + 1 + + + input + trim + + + + + + 1 + + + text + 1 + default + + richtext[]:rte_transform[mode=ts_css] + + + + + diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 248274061..3a1d46a43 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -700,6 +700,18 @@ Bodytext for Email to Sender Inhalt der Mail an Absender + + Double Opt-In Mail + Double Opt-In + + + Subject for Double Opt-In Email + Betreff der Double Opt-In E-Mail + + + Bodytext for Double Opt-in Email + Inhalt der Double Opt-In E-Mail + Submit Page Antwortseite diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 131e29dd1..4b964df15 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -501,6 +501,15 @@ Bodytext for Email to Sender + + Double Opt-In Mail + + + Subject for Double Opt-In Email + + + Bodytext for Double Opt-In Email + Submit Page diff --git a/Resources/Private/Templates/Mail/OptinMail.html b/Resources/Private/Templates/Mail/OptinMail.html index 890099244..cee67f791 100644 --- a/Resources/Private/Templates/Mail/OptinMail.html +++ b/Resources/Private/Templates/Mail/OptinMail.html @@ -6,13 +6,24 @@ Mail will only be send, if Optin was enabled by editor + {powermail_rte} Variable is filled with values from RTE in backend + {powermail_all} Outputs all fields {mail} Complete Mail Object {hash} Hash for optin URI {settings} TypoScript Settings -
+ + + + {powermail_rte} + + + +
+
+