Skip to content

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. Defaults to text.
Options: html text

mailtype="text"

to:email ​

Set the recipient email. The old to parameter still works but is deprecated.

to:email="example@example.com"

to:field and to:map:value ​

Available from v6.0.0

Let the visitor choose the recipient, without letting them enter an email address. to:field is the name of the form field, to:map:value the email address for each value. When the value is not in the map, the email goes to to:email, or is not sent when to:email is empty. In that case {error} is set and a notice is logged.

When the value is in the map, {to:email} holds that address.

{email_template
    to:field="department"
    to:map:sales="sales@example.com"
    to:map:support="support@example.com"
}
html
<select name="department">
    <option value="sales">Sales</option>
    <option value="support">Support</option>
</select>

WARNING

Do not use to:email="{department}" with a value from the form: a visitor could change it to any email address and use your form to send spam.

to:name ​

Set the recipient name, available as {to:name} in the template

to:name="John Doe"

from:email ​

Set the From email. Defaults to the email address of the logged in member, or the Default From setting in the Control Panel.

To use the email address of the visitor, use reply_to:email="{email}" instead, sending from an address on another domain is often marked as spam.

from:email="from@example.com"

from:name ​

Set the From name. Defaults to the screen name of the logged in member.

When there is no From email (a visitor who is not logged in, without from:email), the email is sent from the Default From address, with the from:name as the From name or the site name when from:name is not set.

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 recipients, multiple values separated by a pipe (|)

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

bcc ​

bcc recipients, multiple values separated by a pipe (|)

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

subject ​

Subject for the email

subject="New email"

alt_message ​

The plain text alternative for a mailtype="html" email

alt_message="Thank you for your message"

attachments ​

Include attachments by field name (separated by a pipe (|) for multiple files)

Attachments are only attached to the email and never saved in the submission. They are deleted from the server after sending, unless Delete attachments after sending is disabled in the Control Panel.

attachments="myfile|myfile_2"

name ​

To identify the template in the hooks

name="email_template_1"

respect_br ​

Turn the line breaks into <br> in HTML mode mailtype="html". Defaults to no.

INFO

Inside the form tag, the indentation at the start of each line in {email_template} is removed. The line breaks and empty lines are kept.

respect_br="yes"

direct ​

When using the tag as a standalone tag, set direct="yes" to send the email only once, e.g. for an invoice that is also emailed. Without it, the standalone tag sends the email on every page load.

Once means: no earlier submission with the same form label, from name and email, to, cc, bcc, subject, content, IP address, member and site. So the Save submission setting must be enabled, and another visitor (or another IP address) gets the email again.

Use show_message to also show the email on the page.

{exp:reinos_email_form:email_template direct="yes"} ... {/exp:reinos_email_form:email_template}

show_message ​

Show the parsed email on the page. Defaults to no, also with direct="yes".

show_message="yes"

queue ​

Available from v6.0.0

Add the email to the queue of the Email Queue add-on, which sends it later via its cron job, so the visitor does not wait for the mail server. Defaults to no.

From Email Queue v1.3.0 the attachments, reply_to and alt_message are queued as well. An older version of Email Queue does not store them, so an email with one of those is sent directly. The email is also sent directly when Email Queue is not installed; both are logged as a notice.

queue="yes"

send_email ​

Whether the email is actually sent. Set it to no to only save the submission, without sending an email (a notice is logged).

Defaults to yes

send_email="yes"

allow_duplicate_email_address ​

Allows or disallows the use of duplicate email addresses. This can be useful when using a signup form.

Defaults to yes

allow_duplicate_email_address="yes"

To allow only one submission per email address, set:

allow_duplicate_email_address="no"

The check looks for an earlier submission with the same to:email and the same form_label, so the Save submission setting must be enabled. The recipient is the one after to:map. When a duplicate is detected, the email is not sent, a notice is logged and {error_duplicate_email} and {error} are set.

{if error_duplicate_email}Already send the email{/if}

Notice: set a form_label, e.g. {exp:reinos_email_form:form form_label="my form"}. Without it every form has the label default, so a submission on one form blocks the same address on another. With an empty form_label="" the check is skipped (and a notice is logged).

form_label ​

Only for the standalone tag: the label that is saved with the submission and used by allow_duplicate_email_address. Defaults to default. Inside the form tag, the form_label of the form tag is used.

form_label="newsletter"

Email Template add-on ​

When the Email Template add-on is installed, every email of the Email Form is placed in its HTML template automatically, just like any other email that ExpressionEngine sends. So write only the content in {email_template}, not a full HTML page, otherwise the page ends up inside the template.

Variables ​

Every field of the form is available as a variable, e.g. <input name="address" /> becomes {address}, see Custom variables. The following variables are always available:

VariableDescription
{to:email} {to:name}The recipient (for to:map, the routed address)
{from:email} {from:name}The sender
{reply_to:email} {reply_to:name}The reply to address
{cc} {bcc} {subject}The values of the parameters
{ip}The IP address of the visitor (anonymized when that Privacy setting is enabled)
{httpagent}The user agent of the visitor
{uri_string}The uri of the request
{site_url}The url of the site, including the index page (e.g. https://example.com/index.php/)
{email_template_name}The value of the name parameter

The old variables {to}, {from_email}, {from_name}, {reply_to_email} and {reply_to_name} still work, but are deprecated.

A field with multiple values (e.g. name="hobbies[]") is available as {hobbies} (e.g. [reading, tennis]) and as a loop: {hobbies_pair}{value}{/hobbies_pair}.

The captcha, reCAPTCHA, Turnstile, honeypot and csrf_token fields are never available as variables.

In a mailtype="html" email the submitted values are HTML-escaped.

WARNING

The submitted values are not parsed as ExpressionEngine tags (from v6.0.0). A visitor who types {exp:channel:entries} in a field just sends that text, and a quote in a value cannot add parameters when you use the value in a tag parameter.