Email teamplate
You can customize our teamplate email template, for the purpose of sending emails to customers to promote your brand professionally. To make editing easy, you need some basic skills such as: HTML, CSS…
– To create a new email template you need to access: Dashboard -> WP Form Builder -> Email Teamplates -> Add New.
– The structure of the email template includes HTML, CSS and some small code snippets.
– There are 2 simple ways to create email templates and attach forms data when submitting.
Method 1: Directly use the Field ID value in the form to insert the value into the HTML.
– We have a form with the following structure:
| Filed Label | First ID | Field Type | Code |
|---|---|---|---|
| Name | name | Text | {{name}} |
{{email}} |
|||
| Phone | phone | Phone | {{phone}} |
Email Template:
- You can remove empty fields by using the conditional statement
{% if FIELD_ID is not empty %}and don’t forget to close the conditional statement with{% endif %}. Your email template will then become:
Method 2: Use a loop to write values directly to the email template:
– To use this method, you need to know some skills about array processing and using loops.
– With the form structure as in example 1. We have stored the form information when submitting to the $data variable with the following structure:
[
'name' => [
'label' => "Name",
'value' => 'Jason Robecto',
'type' => 'text'
],
'email' => [
'label' => 'Email',
'value' => 'test@gmail.com',
'type' => 'email'
],
'phone' => [
'label' => 'Phone',
'value' => '0123456789',
'type' => 'tel'
]
]
- After submitting the forms, to create the email template we use a loop to iterate through the form fields:
- You can use loop constructs as follows:
- Structure 1:
– Email template:
- You can remove empty fields by using the conditional statement
{% if item.value is not empty %}and don’t forget to close the conditional statement with{% endif %}. Your email template will then become:
- Save the template and select it in the email section.