diff --git a/Application/Controller/Admin/MailConfigCheck.php b/Application/Controller/Admin/MailConfigCheck.php index 64ab5f7..88862de 100644 --- a/Application/Controller/Admin/MailConfigCheck.php +++ b/Application/Controller/Admin/MailConfigCheck.php @@ -26,12 +26,22 @@ use OxidEsales\Eshop\Core\Registry; class MailConfigCheck extends AdminDetailsController { protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailConfigCheck'; - protected string $testMailAddress = 'test@example.tld'; + protected string $testMailAddress; public function __construct() { parent::__construct(); + try { + $infoMail = Registry::getConfig()->getActiveShop()->getFieldData( 'oxinfoemail' ); + Assert::that($infoMail)->email(); + $re = '/.*(@.*$)/m'; + $subst = "noreply$1"; + $this->testMailAddress = preg_replace($re, $subst, $infoMail); + } catch (InvalidArgumentException) { + $this->testMailAddress = 'test@example.tld'; + } + $this->setSmtpCredentials(); }