From b71eef6d7de06546b56baff6677f89c9f7ac0740 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 26 Jul 2015 16:47:45 +0200 Subject: [PATCH] Don't use private properties of Net_SMTP object --- program/lib/Roundcube/rcube_smtp.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php index bb1d2c840..7400b99ae 100644 --- a/program/lib/Roundcube/rcube_smtp.php +++ b/program/lib/Roundcube/rcube_smtp.php @@ -127,9 +127,12 @@ class rcube_smtp $result = $this->conn->connect($CONFIG['smtp_timeout']); if (is_a($result, 'PEAR_Error')) { - $this->response[] = "Connection failed: ".$result->getMessage(); - $this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $this->conn->_code)); + $this->response[] = "Connection failed: " . $result->getMessage(); + + list($code,) = $this->conn->getResponse(); + $this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $code)); $this->conn = null; + return false; } @@ -160,10 +163,14 @@ class rcube_smtp $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz); if (is_a($result, 'PEAR_Error')) { - $this->error = array('label' => 'smtpautherror', 'vars' => array('code' => $this->conn->_code)); - $this->response[] .= 'Authentication failure: ' . $result->getMessage() . ' (Code: ' . $result->getCode() . ')'; + list($code,) = $this->conn->getResponse(); + $this->error = array('label' => 'smtpautherror', 'vars' => array('code' => $code)); + $this->response[] = 'Authentication failure: ' . $result->getMessage() + . ' (Code: ' . $result->getCode() . ')'; + $this->reset(); $this->disconnect(); + return false; } }