Email Form

Introduction

Effortlessly Create and Manage Emails from Your Templates

Design simple yet powerful email templates directly within your code. Define custom fields and seamlessly integrate dynamically variables into your email templates for maximum flexibility.

No unnecessary clutter in the control panel—just a streamlined experience focused on building and managing your emails directly from your template files.

Keep it simple. Keep it effective. Start creating smarter email workflows today!

banner

Key Features:

Submissions

Save form submissions for later use—or disable saving to comply with GDPR regulations.

(Re)Captcha Support

Fully compatible with both EE Captcha and ReCaptcha to ensure secure form submissions.

Predefined Forms

Easily reuse predefined templates for faster development and consistent results.

Flexibility at Its Core

Build your forms directly within your templates and define template logic in your code.

Documentation versions

How it works

Flexible Email Form Integration with Total Control

The email form provides complete freedom over your form's markup and offers an easy way to handle email delivery.

  1. Form Creation: Start by creating HTML form elements such as <input /> inside the {exp:reinos_email_form:form} tag to build your form. This can be a simple or an complex form, it really depends on your needs.
  2. Email Templates: You define email templates using the {email_template} syntax within the {exp:reinos_email_form:form} tag.

In some scenarios, you might want to send one email template to the admin and a different one to the user, with varying styles or content. By using the {email_template} tag, you can handle these variations effortlessly. It’s common to see two {email_template}tags in such cases.

Dynamic Data Transfer:

When a user submits a form, all posted data is seamlessly transferred to the {email_template} tagpair. For example:

If you have a form field with <input name="address" />, its value will be available as the variable {address} inside the {email_template}.

Special Parameters:

Some parameters have special functionality, like {to:name}.

If you set to:name="John Doe" in {email_template to:name="John Doe"}, this parameter will be converted into the {to:name} variable within the {email_template}. This approach ensures both flexibility and clarity in managing your email forms and templates.

In the example tab you'll find a fully working example.

Installation

Prerequisites

Make sure your system meets the minimum requirements:

Installation Instructions

Update instructions

License

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.

Process of validating

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.

Control panel overview

Once logged in, you are asked to use your current account or to login with another one.

Control panel overview

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.

Control panel overview

License field

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.

Control panel overview

In the Module CP you can enter then your license Control panel overview

When you enter a wrong license, the module will not work and it shows you an warning Control panel overview

Invalid license

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

Control Panel

Settings

Here you can save the common settings

Submissions

Submissions are saved by default. Here you can manage and explorer them.

Forms

Forms added directly in your code can also be saved and managed in the control panel. This feature simplifies the process of editing forms once your site is live.

For example, when your code is version-controlled in Git, deploying minor changes to a form template can become unnecessarily complex. By saving your forms in the control panel, you can make quick edits directly from the interface without touching the codebase.

To display a saved form in your templates, you can use the following tag: {exp:reinos_email_form:get_form name='your_form_name'}

This approach offers both flexibility during development and convenience for ongoing maintenance.

Encryption Key

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

Example

$config['encryption_key'] = 'sy22k6QK6JzH38u4nLZ65bHOdK6VL89d';

Tag

{exp:reinos_email_form:form}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

return_url

Specify the url to return after submission

return_url="/submission/success"

error_return_url

Specify the url to return on error

error_return_url="/form/error"

required_fields

Set the required field for the form

required_fields="field_1|field|2|field_3"

form_label

Set a label so you can identify you submission in the CP by name

form_label="Contact form"

form_class

Set the class of the form

form_class="submission-form"

form_attr:your-attr

Set a custom form attr

form_attr:novalidate="true"

form_id

Set the ID for the form

form_id="submission-form"

secure

Disable/enable the secure function for the forms.

secure="no"

name

If you add a form in the backend, you can select this one here

name=""

allowed_types

Select the types of files that are allowed to upload.

allowed_types="gif|jpg|png"

Tag Variable

Below are the Tag Variables. Those Variables can be used in the tag described above

email_template

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}

success

The succes message

{success}

// or use it to show a custom message
{if success}Your custom message{/if}

error

The error message

{error}

// or use it to show a custom message
{if error}Your error custom message{/if}

validation_errors

Show all validation errors

[EE2]
{validation_errors}

[EE3]
{validation_errors}
    {field} - {error}<br>
{validation_errors}

attachments_error

Show the attachment errors

{attachments_error}

captcha

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}

recaptcha

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}
lang

Set the correct lang for the reCaptcha

See the full list of languages here https://developers.google.com/recaptcha/docs/language

lang="en"

Get Form tag

{exp:reinos_email_form:get_form name=''}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

name

The name of the form

name=""

Custom variables

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}

Email template

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}

Tag Parameters

Below are the Tag Parameters. Those parameters can be used in the tag described above

mailtype

Set the mailtype for sending the email.
Options: html text

mailtype="text"

to

Set the recipient email

to="example@example.com"

from:email

Set the From email

from:email="from@example.com"

from:name

Set the From name

from:name="John Doe"

reply_to:email

Set the reply to email

reply_to:email="reply@example.com"

reply_to:name

Set the reply to name

reply_to:name="John Doe"

cc

cc receipients, Multiple values seperated by a pipline (|)

cc="test@example.com|test2@example.com"

bcc

bcc receipients, Multiple values seperated by a pipline (|)

bcc="test@example.com|test2@example.com"

subject

Subject for the email

subject="New email"

attachments

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"

name

To identify the template in the hooks

name="email_template_1"

respect_br

Respect line breaks in HTML mode mailtype="html"

respect_br="no"

direct

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}

send_email

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"

Hooks

email_form_send_start

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);
}

email_form_send_end

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', '');
}

email_form_form_start

Added in 1.2

if (ee()->extensions->active_hook('email_form_form_start') === TRUE)
{
    ee()->extensions->call('email_form_form_start', '');
}

email_form_form_end

Added in 1.2

if (ee()->extensions->active_hook('email_form_form_end') === TRUE)
{
    $return = ee()->extensions->call('email_form_form_end', $return);
}

email_form_attachment

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);
}

Changelog

5.1.4 (06-01-2025)

5.1.3 (14-11-2024)

5.1.2 (11-10-2024)

5.1.1 (05-09-2024)

5.1.0 (02-10-2023)

5.0.0 (24-05-2023)

4.7.0 (03-11-2022)

4.6.0 (18-10-2022)

4.5.3 (09-05-2022)

4.5.2 (25-05-2021)

4.5.1 (18-05-2021)

4.5.0 (17-02-2021)

4.4.1 (29-12-2020)

4.4.0 (02-12-2020)

4.3.0 (24-09-2020)

4.2.0 (20-08-2020)

4.1.1 (10-08-2020)

4.1.0 (09-06-2020)

4.0.2 (17-05-2020)

4.0.1 (29-07-2019)

4.0.0 (27-06-2019)

*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

3.3.0 (11-04-2019)

3.2.0 (19-12-2018)

3.1.1 (08-06-2018)

3.1.0 (25-04-2018)

*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

3.0.0 (04-12-2017)

2.0.4 (01-11-2017)

2.0.3 (01-05-2017)

2.0.1 (21-06-2016)

2.0.0 (20-06-2016)

1.8.1

1.8

1.7

1.6.1

1.6

1.5.4

1.5.3

1.5.2

1.5.1

1.5

1.4.1

1.4

1.3

1.2.1

1.2

1.1

1.0