diff --git a/data/class/SC_SendMail.php b/data/class/SC_SendMail.php index 903d71d837..17851d5589 100644 --- a/data/class/SC_SendMail.php +++ b/data/class/SC_SendMail.php @@ -357,6 +357,11 @@ public function getBackendParams($backend) switch ($backend) { case 'mail': $arrParams = array(); + $objDb = new SC_Helper_DB_Ex(); + $objSite = $objDb->sfGetBasisData(); + if (!empty($objSite['email04']) && strpos($objSite['email04'], '@') > 0) { + $arrParams[] = "-f ".$objSite['email04']; + } break; case 'sendmail': diff --git a/tests/class/SC_SendMailTest.php b/tests/class/SC_SendMailTest.php index ea13dc3960..850359d8c3 100644 --- a/tests/class/SC_SendMailTest.php +++ b/tests/class/SC_SendMailTest.php @@ -142,9 +142,18 @@ public function testGetRecip() $this->verify(); } + /** + * @runInSeparateProcess + * @preserveGlobalState disabled + */ public function testGetBackendParams() { - $this->expected = []; + $this->objQuery->update('dtb_baseinfo', ['email04' => 'test@example.com']); + $objDb = new SC_Helper_DB_Ex(); + $objSite = $objDb->sfGetBasisData(); + $this->expected = [ + '-f '.$objSite['email04'] + ]; $this->actual = $this->objSendMail->getBackendParams('mail'); $this->verify();