From 8204a1ebd24df1b4293689ff1f269a06f1e85c1d Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Fri, 20 Sep 2024 11:59:28 +0200 Subject: [PATCH] use modified info address from shop for connection test prevent providers RFC 2606 notification --- Application/Controller/Admin/MailConfigCheck.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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(); }