Create simple and easily emails from within your templates. Define your own fields, and use the dynamically created variables inside the email template tag.
Nothing fancy in the control panel (expect saving the submissions), just simple building your email, with template inside your template file.
The idea of the email form is that you have total freedom of the form markup and how to send the email in an easy way.
First you create a <form>
inside the {exp:reinos_email_form:form}
tag. Also you can set an email template with the syntax {email_template}
inside the template tag {exp:reinos_email_form:form}
.
As in some situation you only want to send an email template to the admin or to the admin and the user, but differ in text style. With the {email_template}
you can create it. So it is normal to end up with 2{email_template}
tags.
When a user submit a form, the data that is posted via the form are transferred on the background to the {email_template}
tagpair. So if you have a field with the name name="address"
, the value of address would be converted to the var {address}
inside the tagpair {email_template}
.
Some values are special, like the {to:name}
. As you set the to:name=""
param on the {email_template to:name="John Doe"}
this param will be converted to an variable {to:name}
inside the {email_template}
.
Make sure your system meets the minimum requirements:
ee2/system/third_party/email_form to system/expressionengine/third_party/
For every paid addon you need to validate your license in order to activate the module.
On a local environment, like *.dev
*.local
*.localhost
*.test
the license is valid for testing and building a new or existing sites.
For every other domain, you need to have a valid license.
Once installed, you will asked to enter your license key. When you entered a valid license you can hit the "Save license" button. This will start validating your license and will redirect you to addons.reinos.nl to login into your account. You can also register a new account in this process.
Once logged in, you are asked to use your current account or to login with another one.
Using the current logged in account, the server will check all info related to your license and once valid, it will redirect you back to your site where you see either a success message or an error message.
This module is using a license field to check if the license for the module is valid or not. On addons.reinos.nl you can check your license and add your valid domains.
In the Module CP you can enter then your license
When you enter a wrong license, the module will not work and it shows you an warning
Sometimes it happens that the license system says you have an invalid license. When this happens, make sure you have entered your domain url in your account, next to your license on addons.reinos.nl.
If this will not fix your license problem, please contact us on https://addons.reinos.nl/support
Here you can save the common settings
Submissions are saved by default. Here you can manage and explorer them.
The forms you add in your code can also be saved in the control panel.
The Email Form use the Encryption class provided by CodeIgniter. In order to work with the Email Form you have to setup a key for the Encryption class first.T
To do that you have to add a config for encryption_key
in your config file (ExpressionEngine docs
$config['encryption_key'] = 'sy22k6QK6JzH38u4nLZ65bHOdK6VL89d';
{exp:reinos_email_form:form}
Below are the Tag Parameters. Those parameters can be used in the tag described above
Specify the url to return after submission
return_url="/submission/success"
Specify the url to return on error
error_return_url="/form/error"
Set the required field for the form
required_fields="field_1|field|2|field_3"
Set a label so you can identify you submission in the CP by name
form_label="Contact form"
Set the class of the form
form_class="submission-form"
Set a custom form attr
form_attr:novalidate="true"
Set the ID for the form
form_id="submission-form"
Disable/enable the secure function for the forms.
secure="no"
If you add a form in the backend, you can select this one here
name=""
Select the types of files that are allowed to upload.
allowed_types="gif|jpg|png"
Below are the Tag Variables. Those Variables can be used in the tag described above
Inside this tagpair you can build your own template, instead of using the default templates defined inside the control panel.
More information here
{email_template}
This email is sent to {to:name} with the following message: <br />
{body}
{/email_template}
The succes message
{success}
// or use it to show a custom message
{if success}Your custom message{/if}
The error message
{error}
// or use it to show a custom message
{if error}Your error custom message{/if}
Show all validation errors
[EE2]
{validation_errors}
[EE3]
{validation_errors}
{field} - {error}<br>
{validation_errors}
Show the attachment errors
{attachments_error}
enable the default EE captcha
{if captcha}
<span style="color:red;">{captcha_error}</span><br>
{captcha}<br />
<input type="text" name="captcha" value="" maxlength="20" />
{/if}
enable the recaptcha from google
{!-- init tag should be placed in the head --}
{exp:reinos_email_form:init_recaptcha}
{if recaptcha}
<span style="color:red;">{recaptcha_error}</span><br>
{recaptcha}
{/if}
Set the correct lang for the reCaptcha
See the full list of languages here https://developers.google.com/recaptcha/docs/language
lang="en"
{exp:reinos_email_form:get_form name=''}
Below are the Tag Parameters. Those parameters can be used in the tag described above
The name of the form
name=""
The email_form module whas build because of the use of dynamic variables inside the template which is declared inside your template file and inside the {exp:reinos_email_form:form}
tag.
Those variables are simply defined by declaring form fields. See the example page for a real use case.
In cases of an array defined like
<input name="test[]" type="checkbox" value="1"/>
<input name="test[]" type="checkbox" value="2"/>
<input name="test[]" type="checkbox" value="3"/>
This data is available inside your template as (notice the _pair
at the end of your variable name)
{test_pair}
{value}
{/test_pair}
The email_template is used inside the form tag. This page describes the parameters.
{!-- for inside the form tag --}
{exp:reinos_email_form:form}
{email_template} ... {/email_template}
{/exp:reinos_email_form:form}
or
{exp:reinos_email_form:email_template} ... {/exp:reinos_email_form:email_template}
Below are the Tag Parameters. Those parameters can be used in the tag described above
Set the mailtype for sending the email.
Options: html
text
mailtype="text"
Set the recipient email
to="example@example.com"
Set the From email
from:email="from@example.com"
Set the From name
from:name="John Doe"
Set the reply to email
reply_to:email="reply@example.com"
Set the reply to name
reply_to:name="John Doe"
cc receipients, Multiple values seperated by a pipline (|)
cc="test@example.com|test2@example.com"
bcc receipients, Multiple values seperated by a pipline (|)
bcc="test@example.com|test2@example.com"
Subject for the email
subject="New email"
Include attachments by field name (pipline seperated for multiple files)
Attachement are only attached to the email and not saved on your server.
attachments="myfile|myfile_2"
To identify the template in the hooks
name="email_template_1"
Respect line breaks in HTML mode mailtype="html"
respect_br="no"
When using the tag as a standalone tag, you can set it to direct="yes" so it will send the mail once and display the content on the screen. Great for showing an invoice and send it also directly per mail (once).
With once, we mean just one email. So after a refresh the tag won't send the mail again.
{exp:reinos_email_form:email_template direct="no"} ... {/exp:reinos_email_form:email_template}
Control if we send actual an email. In some situations you would need the submission saved in the submission table but don't want to send the mail.
Default to yes
send_email="yes"
This hook is called right before sending the email. With this hook you can modify the data. (e.g. for in Postmaster)
Added in 1.0
if (ee()->extensions->active_hook('email_form_send_start') === TRUE)
{
$email_data = ee()->extensions->call('email_form_send_start', $email_data);
}
This hook is called right after sending the email.
Added in 1.0
if (ee()->extensions->active_hook('email_form_send_end') === TRUE)
{
ee()->extensions->call('email_form_send_end', '');
}
Added in 1.2
if (ee()->extensions->active_hook('email_form_form_start') === TRUE)
{
ee()->extensions->call('email_form_form_start', '');
}
Added in 1.2
if (ee()->extensions->active_hook('email_form_form_end') === TRUE)
{
$return = ee()->extensions->call('email_form_form_end', $return);
}
assign extra files via an extension. Make sure you return an array with filenames
Added in 1.8
if (ee()->extensions->active_hook('email_form_attachment') === TRUE)
{
ee()->extensions->call('email_form_attachment', $extra_fields, $vars);
}
{email_template send_email="no"}
to control if you actual send an email or just save the submission only{email_template}
could not be parsed and as a result no email was send{success}
and {error}
messagesallowed_types
is not merged with the default typeslang=""
for the {exp:reinos_email_form:init_recaptcha}
tagrespect_br="yes"
to respect line breaks in mailtype="html"
modeform_label
to identify a submission {<your_field_name>_pair}
reinos_
due the release of the EE store (\Breaking changes)***Note: There is a change you will have to validate the license again
\Note:** Because the module has been renamed with a prefix reinos_
there is an update path
by simply add the new update to your site and install it. By installing the module, you are disabling the old module
that can be deleted afterward. Also note that you have to rename the module calls and hooks with a prefix reinos_
See this article about the rename https://addons.reinos.nl/news/modules-renamed
form_attr:your-attr=""
param for adding custom attributes to the form element*Note: you need to add your license key and license email from addons.reinos.nl in order to validate your license and add a valid domain url in your license field on addons.reinos.nl/profile/licenses or the module will not work on a live site. Also make sure you have read the license section in the documentation