Make WordPress Core


Ignore:
Timestamp:
02/28/2022 09:36:22 PM (2 years ago)
Author:
SergeyBiryukov
Message:

External Libraries: Upgrade PHPMailer to version 6.6.0.

This is a minor feature release.

Prior to this version, any OAuth provider needed to extend the provided OAuth base class, and this made it difficult to use with libraries other than ones based on the default league client packages. The OAuth property now accepts anything that implements the OAuthProviderInterface, making it much easier to use things like Google's own OAuth classes. Existing implementations that extend the provided OAuth base class will still work, as that base class now implements this interface too.

When TLS errors occurred in PHPMailer, the error messages were often missing important info that might help diagnose/solve the problem. These error messages should now be more informative. A minor change is that a TLS error on SMTP connect will now throw an exception if exceptions are enabled.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.0

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.5.4...v6.6.0

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749].

Props jrf, Synchro, miken32.
Fixes #55277.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/PHPMailer/PHPMailer.php

    r52749 r52811  
    359359
    360360    /**
    361      * An instance of the PHPMailer OAuth class.
    362      *
    363      * @var OAuth
     361     * An implementation of the PHPMailer OAuthTokenProvider interface.
     362     *
     363     * @var OAuthTokenProvider
    364364     */
    365365    protected $oauth;
     
    751751     * @var string
    752752     */
    753     const VERSION = '6.5.4';
     753    const VERSION = '6.6.0';
    754754
    755755    /**
     
    21642164                    if ($tls) {
    21652165                        if (!$this->smtp->startTLS()) {
    2166                             throw new Exception($this->lang('connect_host'));
     2166                            $message = $this->getSmtpErrorMessage('connect_host');
     2167                            throw new Exception($message);
    21672168                        }
    21682169                        //We must resend EHLO after TLS negotiation
     
    21942195        if ($this->exceptions && null !== $lastexception) {
    21952196            throw $lastexception;
     2197        } elseif ($this->exceptions) {
     2198            // no exception was thrown, likely $this->smtp->connect() failed
     2199            $message = $this->getSmtpErrorMessage('connect_host');
     2200            throw new Exception($message);
    21962201        }
    21972202
     
    41314136
    41324137    /**
     4138     * Build an error message starting with a generic one and adding details if possible.
     4139     *
     4140     * @param string $base_key
     4141     * @return string
     4142     */
     4143    private function getSmtpErrorMessage($base_key)
     4144    {
     4145        $message = $this->lang($base_key);
     4146        $error = $this->smtp->getError();
     4147        if (!empty($error['error'])) {
     4148            $message .= ' ' . $error['error'];
     4149            if (!empty($error['detail'])) {
     4150                $message .= ' ' . $error['detail'];
     4151            }
     4152        }
     4153
     4154        return $message;
     4155    }
     4156
     4157    /**
    41334158     * Check if an error occurred.
    41344159     *
     
    50305055
    50315056    /**
    5032      * Get the OAuth instance.
    5033      *
    5034      * @return OAuth
     5057     * Get the OAuthTokenProvider instance.
     5058     *
     5059     * @return OAuthTokenProvider
    50355060     */
    50365061    public function getOAuth()
     
    50405065
    50415066    /**
    5042      * Set an OAuth instance.
    5043      */
    5044     public function setOAuth(OAuth $oauth)
     5067     * Set an OAuthTokenProvider instance.
     5068     */
     5069    public function setOAuth(OAuthTokenProvider $oauth)
    50455070    {
    50465071        $this->oauth = $oauth;
Note: See TracChangeset for help on using the changeset viewer.