Skip to content

Commit

Permalink
Version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fabtho committed Dec 7, 2016
0 parents commit d539128
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Classes/MailPostProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace Taywa\Ccemailfield;

class MailPostProcessor extends \TYPO3\CMS\Form\PostProcess\MailPostProcessor
{

/**
* Adds the carbon copy receiver of the mail message when configured
*
* Checks the address if it is a valid email address
*
* @return void
*/
protected function setCc()
{
if (isset($this->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);
}
}
}
101 changes: 101 additions & 0 deletions Documentation/README.rst
Original file line number Diff line number Diff line change
@@ -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 = <p>See you</p>
}
}
}
}
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 *
1 change: 1 addition & 0 deletions README.md
20 changes: 20 additions & 0 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
$EM_CONF[$_EXTKEY] = array(
'title' => '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(),
),
);
Binary file added ext_icon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][TYPO3\CMS\Form\PostProcess\MailPostProcessor::class] = [
'className' => Taywa\Ccemailfield\MailPostProcessor::class,
];

0 comments on commit d539128

Please sign in to comment.