diff --git a/Application/Controller/Admin/MailConfigCheck.php b/Application/Controller/Admin/MailConfigCheck.php index 4eb1ca7..c276f74 100644 --- a/Application/Controller/Admin/MailConfigCheck.php +++ b/Application/Controller/Admin/MailConfigCheck.php @@ -26,7 +26,22 @@ use OxidEsales\Eshop\Core\Registry; class MailConfigCheck extends AdminDetailsController { protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/mailConfigCheck'; - protected string $testMailAddress = 'test@example.dev'; + protected string $testMailAddress = 'test@example.tld'; + + public function __construct() + { + parent::__construct(); + + $this->setSmtpCredentials(); + } + + protected function setSmtpCredentials(): void + { + $shop = Registry::getConfig()->getActiveShop(); + + $this->addTplParam('smtpHost', $shop->getFieldData('oxsmtp')); + $this->addTplParam('smtpUser', $shop->getFieldData('oxsmtpuser')); + } public function render(): string { diff --git a/Application/Controller/Admin/SmtpChecker.php b/Application/Controller/Admin/SmtpChecker.php index 0051333..a53f862 100644 --- a/Application/Controller/Admin/SmtpChecker.php +++ b/Application/Controller/Admin/SmtpChecker.php @@ -64,9 +64,9 @@ class SmtpChecker extends AdminDetailsController ['host' => $shopHost, 'port' => $shopPort] = parse_url(trim($activeShop->getFieldData('oxsmtp'))); } - $this->host = $shopHost; + $this->host = $shopHost ?? ''; $this->addTplParam('smtpHost', Registry::getRequest()->getRequestEscapedParameter('smtpHost')); - $this->port = $shopPort; + $this->port = $shopPort ?? 587; $this->user = Registry::getRequest()->getRequestEscapedParameter('smtpUser') ?: $activeShop->getFieldData('oxsmtpuser'); $this->addTplParam('smtpUser', $this->user); $this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd');