From 37839b269c9b8e457bfc79358fec4b2f6dd082c9 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 9 Jul 2024 23:33:17 +0200 Subject: [PATCH 1/3] show communication protocol from shop # Conflicts: # views/twig/admin/mailConfigCheck.html.twig --- .../Controller/Admin/MailConfigCheck.php | 21 ++++++++++++++++++- .../views/admin/tpl/mailconfigcheck.tpl | 13 ++++++++++++ Application/views/de/translations.php | 2 +- Application/views/en/translations.php | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) 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}] + +
+ [{$communication}] +
[{else}]
[{$oViewConf->getHiddenSid()}] +
[{/if}] diff --git a/Application/views/de/translations.php b/Application/views/de/translations.php index b4e115d..c1c7633 100644 --- a/Application/views/de/translations.php +++ b/Application/views/de/translations.php @@ -20,7 +20,7 @@ return [ 'D3_MAILCHECKER_CFGCHECK_SHOPSEND_PHPMAILER' => 'PhpMailer', 'D3_MAILCHECKER_CFGCHECK_SHOPSEND_PHPMAILER_DESC' => 'Der Versand über den PhpMailer sollte dringend vermieden werden, da solche Mails meist als Spam eingestuft werden. Wenn Sie alle SMTP-Daten eingegeben haben, prüfen Sie mögliche Anmeldeprobleme im SMTP-Check.', 'D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP' => 'SMTP', - 'D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP_DESC' => 'Alles in bester Ordnung. Bitte prüfen Sie noch die nötigen SPF-Einträge für Ihre Domain(s).', + 'D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP_DESC' => 'Alles in bester Ordnung. Bitte prüfen Sie noch die nötigen Einstellungen im Tab "Authorisierung Check" für Ihre Domain(s).', 'D3_MAILCHECKER_CFGCHECK_STARTCHECK' => 'Konfiguration testen', 'D3_MAILCHECKER_SMTPCHECK_DESC1' => 'Wenn trotz passend eingegebenen Daten kein Mailversand über SMTP erfolgt, kann hier der Anmeldeversuch am Postausgangsserver nachvollzogen werden. Eventuell auftretende Meldungen werden gezeigt.', diff --git a/Application/views/en/translations.php b/Application/views/en/translations.php index 88cb8c6..9c8f678 100644 --- a/Application/views/en/translations.php +++ b/Application/views/en/translations.php @@ -15,7 +15,7 @@ return [ "D3_MAILCHECKER_CFGCHECK_SHOPSEND_PHPMAILER" => "PhpMailer", "D3_MAILCHECKER_CFGCHECK_SHOPSEND_PHPMAILER_DESC" => "Sending via PhpMailer should be avoided as such emails are usually classified as spam. Once you have entered all SMTP data, check possible login problems in the SMTP check.", "D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP" => "SMTP", - "D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP_DESC" => "Everything is fine. Please check the necessary SPF entries for your domain(s).", + "D3_MAILCHECKER_CFGCHECK_SHOPSEND_SMTP_DESC" => "Everything is fine. Please check the necessary settings for your domain(s) in the \"Authentication Check\" tab .", "D3_MAILCHECKER_CFGCHECK_STARTCHECK" => "Test configuration", "D3_MAILCHECKER_SMTPCHECK_DESC1" => "If no mail is sent via SMTP despite the appropriate data entered, the attempt to log in to the outgoing mail server can be repeated here. Any messages that may occur are shown.", "D3_MAILCHECKER_SMTPCHECK_DESC2" => "New connections can also be tested here in advance.", From 132d618a06761666e6b35bd625b2792bc68bc8fa Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 9 Jul 2024 23:36:11 +0200 Subject: [PATCH 2/3] set EHLO domain in SMTP check --- Application/Controller/Admin/SmtpChecker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Controller/Admin/SmtpChecker.php b/Application/Controller/Admin/SmtpChecker.php index 6e5a969..1ba08c7 100644 --- a/Application/Controller/Admin/SmtpChecker.php +++ b/Application/Controller/Admin/SmtpChecker.php @@ -123,7 +123,7 @@ class SmtpChecker extends AdminDetailsController { $this->action = __FUNCTION__; Assert::that( - ($this->smtp = new Net_SMTP($this->host, $this->port)), + ($this->smtp = new Net_SMTP($this->host, $this->port, $_SERVER['HTTP_HOST'])), Registry::getLang()->translateString('D3_MAILCHECKER_SMTPCHECK_INSTANCE') )->isInstanceOf( Net_SMTP::class, From 336294144993b305a4182fb1a5114012e16adb09 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Wed, 10 Jul 2024 08:25:01 +0200 Subject: [PATCH 3/3] complete documentation --- CHANGELOG.md | 10 +++++++++- metadata.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d69767..cd8f79d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://git.d3data.de/D3Public/MyModule/compare/2.1.0.0...rel_2.x) +## [Unreleased](https://git.d3data.de/D3Public/MyModule/compare/2.1.1.0...rel_2.x) + +## [2.1.1.0](https://git.d3data.de/D3Public/MailConfigChecker/compare/2.1.0.0...2.1.1.0) - 2024-07-10 +### Added +- get mailer check shows PHPMailer communication with the mail server (can be different from the SMTP check) +- recipient for get mailer check can modified in hidden form element + +### Changed +- SMTP check uses shop domain for EHLO ## [2.1.0.0](https://git.d3data.de/D3Public/MailConfigChecker/compare/2.0.0.1...2.1.0.0) - 2024-06-05 ### Added diff --git a/metadata.php b/metadata.php index 372415f..a241b2f 100644 --- a/metadata.php +++ b/metadata.php @@ -40,7 +40,7 @@ $aModule = [ 'en' => '', ], 'thumbnail' => 'picture.svg', - 'version' => '2.1.0.0', + 'version' => '2.1.1.0', 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/',