Feature #76857
closedEXT:form Dynamic Recipients Concept
100%
Description
The possibility to define a dynamic recipient for a contact form has been discussed in the past, and the 1st approach of defining this like it is possible for the sender (senderEmailField) leads to the problem that the form can be abused to send emails to anybody.
However, a usual requirement is that there are predefined recipients for departments, like sales, support, payments etc. or a selection of products which are accociated with the product managers.
My suggestion is to handle it like that:
The form contains a dropdown or radio buttons where the user can select between “Sales”, “Support” and “Payments” in our example, which define the values 1, 2 and 3.
In the form definition this fieldname is set as a keyfield, and the email addresses are defined as an array. So there’s no chance another email address can be entered by the website user.
Example code for the Combobox:
10 = SELECT 10 { class = form-control name = recipientkey required = required size = 1 label { value = Recipient } 10 = OPTION 10 { text = Sales Department selected = selected value = 1 } 20 = OPTION 20 { text = Support Team value = 2 } 30 = OPTION 30 { text = Payments related value = 3 } }
Example code for the post processor part:
1 = mail 1 { recipientEmailKeyField = recipientkey recipientEmail { 1 = sales@typo3.org 2 = support@typo3.org 3 = typo3@paymentprovider.org } }
I already implemented this in a project here and would like to add this feature after a short discussion.