Email finisher
The EmailFinisher sends an email to one recipient. EXT:form has two EmailFinishers with the identifiers EmailToReceiver and EmailToSender.
Table of contents
Important
Finishers are executed in the order defined in your form definition.
Using email finishers in the backend form editor
Editors can use two email finishers in the backend form editor:
- Email to sender (form submitter)
- This finisher sends an email with the contents of the form to the user submitting the form .
- Email to receiver (you)
- This finisher sends an email with the contents of the form to the owner of the website. The settings of this finisher are the same as the "Email to sender" finisher
Options of the email finisher
Subject [subject]
-
- Type
- string
- Required
true
Subject of the email.
Recipients [recipients]
-
- Type
- array
- Required
true
Email addresses and names of the recipients (To).
- Email Address
- Email address of a recipient, e.g. "some.recipient@example.com" or "{email-1}".
- Name
- Name of a recipient, e.g. "Some Recipient" or "{text-1}".
Sender address [senderAddress]
-
- Type
- string
- Required
true
Email address of the sender, for example "your.company@example.org".
If smtp is used, this email address needs to be allowed by the SMTP server. Use
replyif you want to enable the receiver to reply to the message.To Recipients
Sender name [senderName]
-
- Type
- string
- Default
''
Name of the sender, for example "Your Company".
Reply-to Recipients [replyToRecipients]
-
- Type
- array
- Default
[]
Email address which will be used when someone replies to the email.
- Email Address:
- Email address for reply-to.
- Name
- Name for reply-to.
CC Recipient [carbonCopyRecipients]
-
- Type
- array
- Default
[]
Email address to which a copy of the email is sent. The information is visible to all other recipients.
- Email Address:
- Email address for CC.
- Name
- Name for CC.
BCC Recipients [blindCarbonCopyRecipients]
-
- Type
- array
- Default
[]
Email address to which a copy of the email is sent. The information is not visible to any of the recipients.
- Email Address:
- Email address for BCC.
- Name
- Name for BCC.
Add HTML part [addHtmlPart]
-
- Type
- bool
- Default
true
If set, emails will contain plaintext and HTML, otherwise only plaintext. In this way, HTML can be disabled and plaintext-only emails enforced.
Attach uploads [attachUploads]
-
- Type
- bool
- Default
true
If set, all uploaded items are attached to the email.
Title [title]
-
- Type
- string
- Default
undefined
The title shown in the email.
Translation language [translation.language]
-
- Type
- string
- Default
undefined
If not set, the finisher options are translated depending on the current frontend language (if translations exist). This option allows you to force translations for a given language isocode, e.g.
daorde. See Translate finisher options.
Additional email finisher options
Additional options can be set in the form definition YAML and programmatically in the options array but not in the backend editor:
Properties excluded from translation [translation.propertiesExcludedFromTranslation]
-
- Type
- array
- Default
undefined
If not set, the finisher options are translated depending on the current frontend language (if translations exists). This option allows you to force translations for a given language isocode, e.g 'da' or 'de'. See Translate finisher options. It will be skipped for all specified finisher options.
translation.translationFiles
-
- Type
- array
- Default
undefined
If set, this translation file(s) will be used for finisher option translations. If not set, the translation file(s) from the
Formelement will be used. Read Translate finisher options.
layoutRootPaths
-
- Type
- array
- Default
undefined
Fluid layout paths.
partialRootPaths
-
- Type
- array
- Default
undefined
Fluid partial paths.
templateRootPaths
-
- Type
- array
- Default
undefined
Fluid template paths; all templates get the current
Formassigned asRuntime formand theFinisherassigned asVariable Provider finisher.Variable Provider
variables
-
- Type
- array
- Default
undefined
Associative array of variables which are available inside the Fluid template.
Email finishers in the YAML form definition
This finisher sends an email to one recipient.
EXT:form has two email finishers with identifiers
Email and Email.
Using Email finishers in PHP code
Developers can create a confirmation finisher by using the key Email
or Email.
<?php
use TYPO3\CMS\Form\Domain\Model\FormDefinition;
class SomeClass
{
private function addEmailToReceiverFinisher(FormDefinition $formDefinition)
{
$formDefinition->createFinisher('EmailToReceiver', [
'subject' => 'Your message',
'recipients' => [
'your.company@example.com' => 'Your Company name',
'ceo@example.com' => 'CEO'
],
'senderAddress' => $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'],
'senderName' => $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'],
]);
}
}
This finisher is implemented in
\TYPO3\.
Working with BCC recipients
Email finishers can work with different recipient types, including Carbon Copy
(CC) and Blind Carbon Copy (BCC). Depending on the configuration of your server
and TYPO3 instance, it may not be possible to send emails to BCC recipients.
The
$GLOBALS
configuration value is important here. As documented in CORE API,
TYPO3 recommends using the parameter
-bs (instead of
-t -) with
sendmail. The parameter
-bs tells TYPO3 to use the SMTP standard
so that BCC recipients are properly set. Symfony
also mentions the
-t parameter problem. Since TYPO3 7.5
(#65791)
the
transport_ is automatically set from the PHP runtime
configuration and saved. If you have problems sending emails to BCC
recipients, this could be the solution.
About FluidEmail
Changed in version 12.0
The
Email always sends email via
Fluid.
The FluidEmail finisher allows emails to be sent in a standardized way.
The finisher has an
option property
title that adds an email title to the default
FluidEmail template. Variables can be used in options using the bracket syntax.
These variables can be overwritten by FlexForm configuration in the form plugin
Use these options to customize the fluid templates:
template: The template name (for both HTML and plaintext, without the extension)Name template: The paths to the templatesRoot Paths partial: The paths to the partialsRoot Paths layout: The paths to the layoutsRoot Paths
Note
The field
template is no longer evaluated.
Here is an example finisher configuration:
identifier: contact
type: Form
prototypeName: standard
finishers:
-
identifier: EmailToSender
options:
subject: 'Your Message: {message}'
title: 'Hello {name}, your confirmation'
templateName: ContactForm
templateRootPaths:
100: 'EXT:my_site_package/Resources/Private/Templates/Email/'
partialRootPaths:
100: 'EXT:my_site_package/Resources/Private/Partials/Email/'
addHtmlPart: true
These template files must exist:
EXT:my_ site_ package/ Resources/ Private/ Templates/ Email/ Contact Form. html EXT:my_ site_ package/ Resources/ Private/ Templates/ Email/ Contact Form. txt