[TASK] Installation name in mail test
[Packages/TYPO3.CMS.git] / 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();
@@ -151,6 +151,20 @@ class TestSetup extends Action\AbstractAction {
                        : 'TYPO3 CMS install tool';
        }
 
+       /**
+        * 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
         *