diff --git a/wp-includes/PHPMailer/PHPMailer.php b/wp-includes/PHPMailer/PHPMailer.php index 25b04e42d0..10f3fe8cda 100644 --- a/wp-includes/PHPMailer/PHPMailer.php +++ b/wp-includes/PHPMailer/PHPMailer.php @@ -358,9 +358,9 @@ class PHPMailer public $AuthType = ''; /** - * An instance of the PHPMailer OAuth class. + * An implementation of the PHPMailer OAuthTokenProvider interface. * - * @var OAuth + * @var OAuthTokenProvider */ protected $oauth; @@ -750,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.5.4'; + const VERSION = '6.6.0'; /** * Error severity: message only, continue processing. @@ -2163,7 +2163,8 @@ class PHPMailer } if ($tls) { if (!$this->smtp->startTLS()) { - throw new Exception($this->lang('connect_host')); + $message = $this->getSmtpErrorMessage('connect_host'); + throw new Exception($message); } //We must resend EHLO after TLS negotiation $this->smtp->hello($hello); @@ -2193,6 +2194,10 @@ class PHPMailer //As we've caught all exceptions, just report whatever the last one was if ($this->exceptions && null !== $lastexception) { throw $lastexception; + } elseif ($this->exceptions) { + // no exception was thrown, likely $this->smtp->connect() failed + $message = $this->getSmtpErrorMessage('connect_host'); + throw new Exception($message); } return false; @@ -4129,6 +4134,26 @@ class PHPMailer return $key; } + /** + * Build an error message starting with a generic one and adding details if possible. + * + * @param string $base_key + * @return string + */ + private function getSmtpErrorMessage($base_key) + { + $message = $this->lang($base_key); + $error = $this->smtp->getError(); + if (!empty($error['error'])) { + $message .= ' ' . $error['error']; + if (!empty($error['detail'])) { + $message .= ' ' . $error['detail']; + } + } + + return $message; + } + /** * Check if an error occurred. * @@ -5029,9 +5054,9 @@ class PHPMailer } /** - * Get the OAuth instance. + * Get the OAuthTokenProvider instance. * - * @return OAuth + * @return OAuthTokenProvider */ public function getOAuth() { @@ -5039,9 +5064,9 @@ class PHPMailer } /** - * Set an OAuth instance. + * Set an OAuthTokenProvider instance. */ - public function setOAuth(OAuth $oauth) + public function setOAuth(OAuthTokenProvider $oauth) { $this->oauth = $oauth; } diff --git a/wp-includes/PHPMailer/SMTP.php b/wp-includes/PHPMailer/SMTP.php index 138177060e..5ecad21dae 100644 --- a/wp-includes/PHPMailer/SMTP.php +++ b/wp-includes/PHPMailer/SMTP.php @@ -35,7 +35,7 @@ class SMTP * * @var string */ - const VERSION = '6.5.4'; + const VERSION = '6.6.0'; /** * SMTP line break constant. @@ -483,7 +483,7 @@ class SMTP * @param string $username The user name * @param string $password The password * @param string $authtype The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2) - * @param OAuth $OAuth An optional OAuth instance for XOAUTH2 authentication + * @param OAuthTokenProvider $OAuth An optional OAuthTokenProvider instance for XOAUTH2 authentication * * @return bool True if successfully authenticated */ diff --git a/wp-includes/version.php b/wp-includes/version.php index a37b93ab14..eb99a17adf 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52810'; +$wp_version = '6.0-alpha-52811'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.