Introduction
A form is a web page containing fields to be completed by an individual. When the form is submitted, the person is redirected to a confirmation page.
You can trigger the sending of an email following the submission of a form by an individual. To do this, the recipient's email address must be entered in one of the form fields.
This article describes how the form should be configured to enable this trigger.
Example of a sponsorship form:
You want to create a form that allows an individual (sponsor) to sponsor people (godchildren).
When the sponsor submits the sponsorship form, an email is sent to each of the sponsored friends informing them that they have been sponsored.
Configure the email to be triggered
First go to the Sendingly module to create the email application campaign that will be triggered when the form is submitted.
If you don't know how to create an email application campaign, read the article Sending an email > Email application path.
Creating this campaign allows you to generate the "content code" for the email, which you will need to link to the form.
Mandatory fields
The HTML of the web page with form that triggers the sending of an email must contain the following fields:
| Informations | Fields | Exemple |
|
The code contained in the email application linked to the form (identifiable on Sendingly) |
FORM_TEMPLATE_NAME |
<input name="FORM_TEMPLATE_NAME" value="81362d15-d019-47e1-9ec3-4bb8ec84ce7c" type="hidden" /> |
| Recipient emails (at least one recipient) |
SPONSORED_N_EMAIL N= de 1 à 5 pour différencier les individus |
<input required name="SPONSORED_1_EMAIL" type="email" value=""/> |
| Type of form (which triggers the sending of an email) | FORM_TYPE = SPONSORING | <input name="FORM_TYPE" value="SPONSORING" type="hidden" /> |
Sample form: sponsorship form
The sponsor who fills in the form can sponsor up to 3 godchildren. The fields below must be included in the form:
- Content code of the email to be triggered :
FORM_TEMPLATE_NAME
- Recipient email addresses :
Godchild 1
- SPONSORED_1_EMAIL
Godchild 2
- SPONSORED_2_EMAIL
Godchild 3
- SPONSORED_3_EMAIL
- Form type :
- FORM_TYPE = SPONSORING
Customisation fields
The email triggered can be personalised with the data collected in the form. To do this, you need to name the fields in the form according to the nomenclature below:
| Informations | Fields | Exemple |
| Recipient information (surname, first name, etc.) | SPONSORED_N_xxx | <input required name="SPONSORED_1_NAME" type="email" value=""/> |
| Information about the triggering individual (email, surname, first name, etc.) | SPONSOR_XXX | <input name="SPONSOR_MAIL" placeholder="Insert your email"
value=""/> |
These personalised fields can then be added to the content of the email application.
Let's take the example of the sponsorship form again.
The sponsorship form collects the first and last names of the sponsor and the 3 sponsored friends. You want the sponsorship email to inform the sponsored friend of the name and surname of their sponsor.
The fields below must be included in the form:
- Information about the triggering individual (sponsor) :
- SPONSOR_LASTNAME
- SPONSOR_FIRSTNAME
- Information about the recipients (godchildren) :
Godchildren 1
- SPONSORED_1_NAME
- SPONSORED_1_FIRSTNAME
Godchildren 2
- SPONSORED_2_NAME
- SPONSORED_2_FIRSTNAME
Godchildren 3
- SPONSORED_3_NAME
- SPONSORED_3_FIRSTNAME
Example of the content of the transactional email received by sponsored friend 2:
Hello
{{MM:SPONSORED_2_FIRSTNAME}} {{MM:SPONSORED_2_NAME}}, you have been sponsored by {{MM:SPONSOR_FIRSTNAME}} {{MM:SPONSOR_NAME}}!
The fields below must be included in the transactional email:
- Information about the triggering individual (sponsor) :
- SPONSOR_LASTNAME
- SPONSOR_FIRSTNAME
- Information about the recipient (1 sending per godchild) :
- SPONSORED_NAME
- SPONSORED_FIRSTNAME
Note : the number in the field disappeared
Each godchild will recevive one email with his own information
Conclusion
By following this field structure for your form, you can ensure that your customised transactional email is triggered.