From 346a2f9da78069bf610fc276012c7a9f9df3f71f Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Fri, 21 Feb 2020 00:14:48 +0100 Subject: [PATCH] [DOCS] Adjust documentation for Fluid-based templated emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A feature regarding the subject and localization was missing in the initial change / docs, so this is now added. Resolves: #90463 Releases: master Change-Id: Ic0de6abad93b45e3a176df016304bd3806997d7e Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63343 Tested-by: Björn Jacob <bjoern.jacob@tritum.de> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de> Reviewed-by: Benni Mack <benni@typo3.org> --- ...ature-90266-Fluid-basedTemplatedEmails.rst | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-90266-Fluid-basedTemplatedEmails.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-90266-Fluid-basedTemplatedEmails.rst index 7dea169e5f27..10fb163b9b9c 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Feature-90266-Fluid-basedTemplatedEmails.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-90266-Fluid-basedTemplatedEmails.rst @@ -32,6 +32,9 @@ set this in your LocalConfiguration.php / AdditionalConfiguration.php file: * :php:`$GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'][700] = 'EXT:my_site_extension/Resources/Private/Layouts';` +In addition, it is possible to define a section within the Fluid email, +which - if set - takes precedence over the :php:`subject()` method. + Impact ====== @@ -51,4 +54,24 @@ It is possible to use the same API in your custom extension like this: ->assign('mySecretIngredient', 'Tomato and TypoScript'); GeneralUtility::makeInstance(Mailer::class)->send($email); +Defining a custom email subject in a custom template: + +.. code-block:: html + + <f:section name="Subject">New Login at "{typo3.sitename}"</f:section> + +Building templated emails with Fluid also allows to define the language key, +and use this within the Fluid template: + +.. code-block:: php + + $email = GeneralUtility::makeInstance(FluidEmail::class); + $email + ->to('contact@acme.com') + ->assign('language', 'de'); + +.. code-block:: html + + <f:translate languageKey="{language}" id="LLL:my_ext/Resources/Private/Language/emails.xml:subject" /> + .. index:: Fluid, ext:core -- GitLab