From d53912865d127f4566eaa818de8767c0e846c958 Mon Sep 17 00:00:00 2001 From: ft Date: Wed, 7 Dec 2016 17:56:18 +0100 Subject: [PATCH] Version 0.0.1 --- Classes/MailPostProcessor.php | 30 ++++++++++ Documentation/README.rst | 101 ++++++++++++++++++++++++++++++++++ README.md | 1 + ext_emconf.php | 20 +++++++ ext_icon.gif | Bin 0 -> 186 bytes ext_localconf.php | 8 +++ 6 files changed, 160 insertions(+) create mode 100644 Classes/MailPostProcessor.php create mode 100644 Documentation/README.rst create mode 120000 README.md create mode 100644 ext_emconf.php create mode 100644 ext_icon.gif create mode 100644 ext_localconf.php diff --git a/Classes/MailPostProcessor.php b/Classes/MailPostProcessor.php new file mode 100644 index 0000000..498e7b1 --- /dev/null +++ b/Classes/MailPostProcessor.php @@ -0,0 +1,30 @@ +typoScript['ccEmail'])) { + $emails = $this->formUtility->renderItem( + $this->typoScript['ccEmail.'], + $this->typoScript['ccEmail'] + ); + } elseif ($this->getTypoScriptValueFromIncomingData('ccEmailField') !== null) { + $emails = $this->getTypoScriptValueFromIncomingData('ccEmailField'); + } + // die($emails); + $validEmails = $this->filterValidEmails($emails); + if (!empty($validEmails)) { + $this->mailMessage->setCc($validEmails); + } + } +} \ No newline at end of file diff --git a/Documentation/README.rst b/Documentation/README.rst new file mode 100644 index 0000000..70bb1f2 --- /dev/null +++ b/Documentation/README.rst @@ -0,0 +1,101 @@ +====================================== +Add ccEmailField to postProcessor of the sysext Form (TYPO3 V 7 LTS) +====================================== + +What does it do? +======================== + +This extension takes the content a field and uses this content (an e-mail address) when sending the form as CC address. + +To do this MailPostProcessor.php of form is extended, see here: https://github.com/TYPO3-CMS/form/blob/master/Classes/PostProcess/MailPostProcessor.php + +German: + +Diese Erweiterung nimmt den Inhalt ein Feldes und nutz diesen Inhalt (eine E-Mail Adresse) beim Versenden des Formulars als CC Adresse. Damit erhält der Absender des Formulars eine Kopie. + + + +Example of a Configuration as Form Content +============================================ + + +method = post +prefix = tx_form +confirmation = 0 +postProcessor { + 1 = mail + 1 { + ccEmailField = email + recipientEmail = noise@taywa.ch + senderEmail = noise@taywa.ch + subject = Test of ccEmailField + messages { + success = TEXT + success { + value =

See you

+ } + } + } +} +10 { + type = email + name = email + placeholder = Email + required = required + label { + value = Email + } +} +20 = SUBMIT +20 { + type = submit + name = submit + value = Submit +} + + +Link to Extension Repository +======================== +https://typo3.org/extensions/repository/view/taywa_ccemailfield + +======================== +This is the extended class: +https://github.com/TYPO3-CMS/form/blob/master/Classes/PostProcess/MailPostProcessor.php + +Discussions around this: + +- https://stackoverflow.com/questions/29074323/typo3-tx-form-copy-to-sender-recipient-copy +- https://forge.typo3.org/issues/32950 +- https://forge.typo3.org/issues/68771 + + +Typo3 specific: + +- https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Xclasses/Index.html +- https://somethingphp.com/extending-classes-typo3/ +- http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in + + + +Tested in TYPO3 7 LTS only +======================== +I tested this in TYPO3 7 LTS, not in TYPO3 8 + +History +======================== +v 0.0.1: initial version + +Licence +======================== +Public Domain + +Author +======================== +Fabian Thommen, ft@taywa.ch, taywa gmbh, Zürich, 2016 + +Tools +================================================ + +zip this extension for upload to extension repro on typo3.org + + zip -r ../taywa_ccemailfield_0.0.1.zip * diff --git a/README.md b/README.md new file mode 120000 index 0000000..dc4ed59 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Documentation/README.rst \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php new file mode 100644 index 0000000..6eb194e --- /dev/null +++ b/ext_emconf.php @@ -0,0 +1,20 @@ + 'Add ccEmailField to postProcessor of the sysext Form', + 'description' => 'This extension takes the content a field and uses this content (an e-mail address) when sending the form as CC address', + 'category' => 'plugin', + 'state' => 'stable', + 'author' => 'Fabian Thommen', + 'author_email' => 'ft@taywa.ch', + 'author_company' => 'taywa gmbh, Zürich', + 'clearCacheOnLoad' => 0, + 'version' => '0.0.1', + 'constraints' => array( + 'depends' => array( + 'typo3' => '7.6.0-8.99.99', + 'form' => '7.6.0-0.0.0', + ), + 'conflicts' => array(), + 'suggests' => array(), + ), +); \ No newline at end of file diff --git a/ext_icon.gif b/ext_icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..83d8b781960cf8bef9fccd2165d089a44da2ef08 GIT binary patch literal 186 zcmZ?wbhEHb6k-ryIK;vL1e%(f4F7@PJBWY*#sA!Xt|7tBjsdPldIrplKy`}$I7$*L z%MSlsRq)ih)<_1 Taywa\Ccemailfield\MailPostProcessor::class, +];