[TASK] Installation name in mail test 49/36349/2
authorZbigniew Jacko <z.jacko@macopedia.pl>
Thu, 29 Jan 2015 12:20:44 +0000 (13:20 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 29 Jan 2015 13:29:55 +0000 (14:29 +0100)
Add the name of the site (if is set) in subject of test email.

Change-Id: Ib6441e4fd35270cb45b5a9538a4a6e8133c67b05
Resolves: #53087
Releases: master
Reviewed-on: http://review.typo3.org/36349
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php

index 787b58a..3923406 100644 (file)
@@ -114,7 +114,7 @@ class TestSetup extends Action\AbstractAction {
                        $mailMessage
                                ->addTo($recipient)
                                ->addFrom($this->getSenderEmailAddress(), $this->getSenderEmailName())
-                               ->setSubject('Test TYPO3 CMS mail delivery')
+                               ->setSubject($this->getEmailSubject())
                                ->setBody('<html><body>html test content</body></html>', 'text/html')
                                ->addPart('TEST CONTENT')
                                ->send();
@@ -152,6 +152,20 @@ class TestSetup extends Action\AbstractAction {
        }
 
        /**
+        * Gets email subject from configuration
+        * ['TYPO3_CONF_VARS']['SYS']['sitename']
+        * If this setting is empty, it falls back to a default string.
+        *
+        * @return string
+        */
+       protected function getEmailSubject() {
+               $name = !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])
+                       ? ' from site "' .  $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '"'
+                       : '';
+               return 'Test TYPO3 CMS mail delivery' . $name;
+       }
+
+       /**
         * Create true type font test image
         *
         * @return \TYPO3\CMS\Install\Status\StatusInterface