EmailFinisher extends AbstractFinisher
This finisher sends an email to one recipient
Options:
- templateName (mandatory): Template name for the mail body
- templateRootPaths: root paths for the templates
- layoutRootPaths: root paths for the layouts
- partialRootPaths: root paths for the partials
- variables: associative array of variables which are available inside the Fluid template
The following options control the mail sending. In all of them, placeholders in the form of {...} are replaced with the corresponding form value; i.e. {email} as senderAddress makes the recipient address configurable.
- subject (mandatory): Subject of the email
- recipients (mandatory): Email addresses and human-readable names of the recipients
- senderAddress (mandatory): Email address of the sender
- senderName: Human-readable name of the sender
- replyToRecipients: Email addresses and human-readable names of the reply-to recipients
- carbonCopyRecipients: Email addresses and human-readable names of the copy recipients
- blindCarbonCopyRecipients: Email addresses and human-readable names of the blind copy recipients
- title: The title of the email - If not set "subject" is used by default
Scope: frontend
Table of Contents
Properties
- $defaultOptions : array<string|int, mixed>
- These are the default options of the finisher.
- $finisherContext : FinisherContext
- $finisherIdentifier : string
- $options : array<string|int, mixed>
- The options which have been set from the outside. Instead of directly accessing them, you should rather use parseOption().
- $shortFinisherIdentifier : string
Methods
- execute() : string|null
- Executes the finisher
- getFinisherIdentifier() : string
- isEnabled() : bool
- Returns whether this finisher is enabled
- setFinisherIdentifier() : void
- setOption() : mixed
- Sets a single finisher option (@see setOptions())
- setOptions() : mixed
- executeInternal() : string|null
- Executes this finisher
- getRecipients() : array<string|int, mixed>
- Get mail recipients
- getTypoScriptFrontendController() : TypoScriptFrontendController
- initializeFluidEmail() : FluidEmail
- parseOption() : string|array<string|int, mixed>|int|null
- Read the option called $optionName from $this->options, and parse {...} as object accessors.
- resolveRuntimeReference() : int|string|array<string|int, mixed>
- Resolving property by name from submitted form data.
- substituteRuntimeReferences() : mixed
- You can encapsulate an option value with {}.
- translateFinisherOption() : array<string|int, mixed>|string
- Wraps TranslationService::translateFinisherOption to recursively invoke all array items of resolved form state values or nested finisher option configuration settings.
Properties
$defaultOptions
These are the default options of the finisher.
protected
array<string|int, mixed>
$defaultOptions
= ['recipientName' => '', 'senderName' => '', 'addHtmlPart' => true, 'attachUploads' => true]
$finisherContext
protected
FinisherContext
$finisherContext
$finisherIdentifier
protected
string
$finisherIdentifier
= ''
$options
The options which have been set from the outside. Instead of directly accessing them, you should rather use parseOption().
protected
array<string|int, mixed>
$options
= []
$shortFinisherIdentifier
protected
string
$shortFinisherIdentifier
= ''
Methods
execute()
Executes the finisher
public
final execute(FinisherContext $finisherContext) : string|null
Parameters
- $finisherContext : FinisherContext
-
The Finisher context that contains the current Form Runtime and Response
Return values
string|nullgetFinisherIdentifier()
public
getFinisherIdentifier() : string
Return values
stringisEnabled()
Returns whether this finisher is enabled
public
isEnabled() : bool
Return values
boolsetFinisherIdentifier()
public
setFinisherIdentifier(string $finisherIdentifier) : void
Parameters
- $finisherIdentifier : string
-
The identifier for this finisher
setOption()
Sets a single finisher option (@see setOptions())
public
setOption(string $optionName, mixed $optionValue) : mixed
Parameters
- $optionName : string
-
name of the option to be set
- $optionValue : mixed
-
value of the option
setOptions()
public
setOptions(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
-
configuration options in the format ['option1' => 'value1', 'option2' => 'value2', ...]
executeInternal()
Executes this finisher
protected
executeInternal() : string|null
Tags
Return values
string|nullgetRecipients()
Get mail recipients
protected
getRecipients(string $listOption) : array<string|int, mixed>
Parameters
- $listOption : string
-
List option name
Return values
array<string|int, mixed>getTypoScriptFrontendController()
protected
getTypoScriptFrontendController() : TypoScriptFrontendController
Return values
TypoScriptFrontendControllerinitializeFluidEmail()
protected
initializeFluidEmail(FormRuntime $formRuntime) : FluidEmail
Parameters
- $formRuntime : FormRuntime
Return values
FluidEmailparseOption()
Read the option called $optionName from $this->options, and parse {...} as object accessors.
protected
parseOption(string $optionName) : string|array<string|int, mixed>|int|null
Then translate the value.
If $optionName was not found, the corresponding default option is returned (from $this->defaultOptions)
Parameters
- $optionName : string
Return values
string|array<string|int, mixed>|int|nullresolveRuntimeReference()
Resolving property by name from submitted form data.
protected
resolveRuntimeReference(string $property, FormRuntime $formRuntime) : int|string|array<string|int, mixed>
Parameters
- $property : string
- $formRuntime : FormRuntime
Return values
int|string|array<string|int, mixed>substituteRuntimeReferences()
You can encapsulate an option value with {}.
protected
substituteRuntimeReferences(string|array<string|int, mixed> $needle, FormRuntime $formRuntime) : mixed
This enables you to access every gettable property from the TYPO3\CMS\Form\Domain\Runtime\FormRuntime.
For example: {formState.formValues.<elementIdentifier>} or {<elementIdentifier>}
Both examples are equal to "$formRuntime->getFormState()->getFormValues()[<elementIdentifier>]" There is a special option value '{__currentTimestamp}'. This will be replaced with the current timestamp.
Parameters
- $needle : string|array<string|int, mixed>
- $formRuntime : FormRuntime
translateFinisherOption()
Wraps TranslationService::translateFinisherOption to recursively invoke all array items of resolved form state values or nested finisher option configuration settings.
protected
translateFinisherOption(string|array<string|int, mixed> $subject, FormRuntime $formRuntime, string $optionName, string|array<string|int, mixed> $optionValue, array<string|int, mixed> $translationOptions) : array<string|int, mixed>|string
Parameters
- $subject : string|array<string|int, mixed>
- $formRuntime : FormRuntime
- $optionName : string
- $optionValue : string|array<string|int, mixed>
- $translationOptions : array<string|int, mixed>