From 50d40d1b661487df2a912039e0c6e06ab750a68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luciana=20Nu=C3=B1ez?= Date: Wed, 19 Oct 2022 12:22:42 -0400 Subject: [PATCH] PMCORE-4032 --- workflow/engine/controllers/adminProxy.php | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index b2521582c..1835061af 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -449,18 +449,23 @@ class adminProxy extends HttpProxyController $this->msg = $this->result ? '' : $Server->error; break; case 3: //try to connect to host - if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) { - $server = $hostinfo[1]; - $port = $hostinfo[2]; - } else { - $host = $srv; + try { + if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) { + $server = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $server = $srv; + } + + $tls = (strtoupper($SMTPSecure) === 'TLS'); + $ssl = (strtoupper($SMTPSecure) === 'SSL'); + + $this->success = $smtp->Connect(($ssl ? 'ssl://':'') . $server, $port, $timeout); + $this->msg = $this->result ? '' : $Server->error; + } catch (Exception $e) { + $this->success = false; + $this->msg = $e->getMessage(); } - - $tls = (strtoupper($SMTPSecure) == 'tls'); - $ssl = (strtoupper($SMTPSecure) == 'ssl'); - - $this->success = $smtp->Connect(($ssl ? 'ssl://':'').$server, $port, $timeout); - $this->msg = $this->result ? '' : $Server->error; break; case 4: //try login to host if ($auth_required == 'true') {