[BUGFIX] Optimize workspace notification emails 78/63878/3
authorBenni Mack <benni@typo3.org>
Mon, 23 Mar 2020 13:35:51 +0000 (14:35 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 23 Mar 2020 15:30:39 +0000 (16:30 +0100)
When transforming the workspace notification emails, the option to set
an alternative email sender was not added, but is now configurable properly.

Resolves: #46634
Releases: master
Change-Id: I3c254de90ce2c490f1e076eee60e99c885f91575
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63878
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <look@susi.dev>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/10.3/Feature-90411-HTML-basedWorkspaceNotificationEmailsOnStageChange.rst
typo3/sysext/workspaces/Classes/Notification/StageChangeNotification.php

index ff0771b..889b98b 100644 (file)
@@ -32,7 +32,10 @@ The following TSconfig options have been added:
    tx_workspaces.emails.layoutRootPaths.100 = EXT:myproject/...
    tx_workspaces.emails.partialRootPaths.100 = EXT:myproject/...
    tx_workspaces.emails.templateRootPaths.100 = EXT:myproject/...
-   tx_workspaces.emails.format = html/text/both
+   # valid formats are "text", "html" or "both"
+   tx_workspaces.emails.format = html
+   tx_workspaces.emails.senderEmail = workspaces@example.com
+   tx_workspaces.emails.senderName = Your TYPO3 at Example.com
 
 The template name is always called `StageChangeNotification`.
 
index eb5fd8a..b775b3f 100644 (file)
@@ -148,6 +148,9 @@ class StageChangeNotification
         if ($emailConfig['format']) {
             $emailObject->format($emailConfig['format']);
         }
+        if (!empty($emailConfig['senderEmail']) && GeneralUtility::validEmail($emailConfig['senderEmail'])) {
+            $emailObject->from(new Address($emailConfig['senderEmail'], $emailConfig['senderName'] ?? ''));
+        }
         $this->mailer->send($emailObject);
     }
 }