diff --git a/Application/Controller/Admin/MailConfigCheck.php b/Application/Controller/Admin/MailConfigCheck.php
index ad02f2b..79f3e4a 100644
--- a/Application/Controller/Admin/MailConfigCheck.php
+++ b/Application/Controller/Admin/MailConfigCheck.php
@@ -33,6 +33,7 @@ class MailConfigCheck extends AdminDetailsController
{
$this->checkDataAreSet();
$this->addTplParam('shop', Registry::getConfig()->getActiveShop());
+ $this->addTplParam('recipient', $this->testMailAddress);
return parent::render();
}
@@ -74,13 +75,31 @@ class MailConfigCheck extends AdminDetailsController
{
try {
$shop = Registry::getConfig()->getActiveShop();
+ $config = Registry::getConfig();
$mail = oxNew(Email::class);
- $mail->setRecipient($this->testMailAddress);
+ $mail->setRecipient(
+ trim(Registry::getRequest()->getRequestEscapedParameter('recipient')) ?: $this->testMailAddress
+ );
$mail->setBody('.');
$mail->setFrom($shop->getFieldData('oxowneremail'));
+
+ $currentDebug = $config->getConfigParam('iDebug');
+ $config->setConfigParam('iDebug', 6);
+ $mail->setSmtp();
+
+ ob_start();
$mail->send();
+ $communication = ob_get_contents();
+ ob_end_clean();
+
+ $re = '/(^|\
)(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s)/m';
+ $subst = "$1";
+ $communication = preg_replace($re, $subst, $communication);
+
+ $config->setConfigParam('iDebug', $currentDebug);
$this->addTplParam('mailer', $mail->getMailer());
+ $this->addTplParam('communication', $communication);
} catch (Exception $e) {
Registry::getUtilsView()->addErrorToDisplay($e);
}
diff --git a/Application/views/admin/tpl/mailconfigcheck.tpl b/Application/views/admin/tpl/mailconfigcheck.tpl
index 696239e..542254b 100644
--- a/Application/views/admin/tpl/mailconfigcheck.tpl
+++ b/Application/views/admin/tpl/mailconfigcheck.tpl
@@ -5,6 +5,14 @@
span.btn {
cursor: default;
}
+
+ .communicationoutput {
+ background-color: black;
+ color: white;
+ max-height: 500px;
+ overflow: auto;
+ margin-top: 30px;
+ }
[{assign var="readonly" value="readonly disabled"}]
@@ -52,11 +60,16 @@
[{oxmultilang ident="D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP_DESC"}]
[{/if}]
+
+