From 6986a6ca99150cd618f56a33aad13c087ea940e2 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Fri, 29 Jun 2018 16:19:48 +0200 Subject: [PATCH] Aggiunto test SMTP --- modules/smtp/actions.php | 7 +++++++ src/Mail.php | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/modules/smtp/actions.php b/modules/smtp/actions.php index 01f929990..6c6461ae4 100644 --- a/modules/smtp/actions.php +++ b/modules/smtp/actions.php @@ -65,6 +65,13 @@ switch (post('op')) { } } + $mail = new Mail($id_record); + if ($mail->testSMTP()) { + $_SESSION['infos'][] = tr('Connessione SMTP riuscita'); + } else { + $_SESSION['errors'][] = tr('Connessione SMTP non riuscita'); + } + break; case 'delete': diff --git a/src/Mail.php b/src/Mail.php index 22df229fc..1c64d457c 100644 --- a/src/Mail.php +++ b/src/Mail.php @@ -222,4 +222,15 @@ class Mail extends PHPMailer\PHPMailer\PHPMailer return $result; } + + public function testSMTP() + { + if ($this->IsSMTP() && $this->smtpConnect()) { + $this->smtpClose(); + + return true; + } + + return false; + } }