Changeset 60813 for trunk/src/wp-includes/PHPMailer/SMTP.php
- Timestamp:
- 09/30/2025 12:46:53 PM (14 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/PHPMailer/SMTP.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/PHPMailer/SMTP.php
r60623 r60813 36 36 * @var string 37 37 */ 38 const VERSION = '6.1 0.0';38 const VERSION = '6.11.0'; 39 39 40 40 /** … … 206 206 'ZoneMTA' => '/[\d]{3} Message queued as (.*)/', 207 207 'Mailjet' => '/[\d]{3} OK queued as (.*)/', 208 'Gsmtp' => '/[\d]{3} 2\.0\.0 OK (.*) - gsmtp/', 208 209 ]; 209 210 … … 634 635 } 635 636 $oauth = $OAuth->getOauth64(); 636 637 //Start authentication 638 if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { 639 return false; 637 /* 638 * An SMTP command line can have a maximum length of 512 bytes, including the command name, 639 * so the base64-encoded OAUTH token has a maximum length of: 640 * 512 - 13 (AUTH XOAUTH2) - 2 (CRLF) = 497 bytes 641 * If the token is longer than that, the command and the token must be sent separately as described in 642 * https://www.rfc-editor.org/rfc/rfc4954#section-4 643 */ 644 if ($oauth === '') { 645 //Sending an empty auth token is legitimate, but it must be encoded as '=' 646 //to indicate it's not a 2-part command 647 if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 =', 235)) { 648 return false; 649 } 650 } elseif (strlen($oauth) <= 497) { 651 //Authenticate using a token in the initial-response part 652 if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { 653 return false; 654 } 655 } else { 656 //The token is too long, so we need to send it in two parts. 657 //Send the auth command without a token and expect a 334 658 if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2', 334)) { 659 return false; 660 } 661 //Send the token 662 if (!$this->sendCommand('OAuth TOKEN', $oauth, [235, 334])) { 663 return false; 664 } 665 //If the server answers with 334, send an empty line and wait for a 235 666 if ( 667 substr($this->last_reply, 0, 3) === '334' 668 && $this->sendCommand('AUTH End', '', 235) 669 ) { 670 return false; 671 } 640 672 } 641 673 break; … … 1310 1342 //stream_select returns false when the `select` system call is interrupted 1311 1343 //by an incoming signal, try the select again 1312 if (stripos($message, 'interrupted system call') !== false) { 1344 if ( 1345 stripos($message, 'interrupted system call') !== false || 1346 ( 1347 // on applications with a different locale than english, the message above is not found because 1348 // it's translated. So we also check for the SOCKET_EINTR constant which is defined under 1349 // Windows and UNIX-like platforms (if available on the platform). 1350 defined('SOCKET_EINTR') && 1351 stripos($message, 'stream_select(): Unable to select [' . SOCKET_EINTR . ']') !== false 1352 ) 1353 ) { 1313 1354 $this->edebug( 1314 1355 'SMTP -> get_lines(): retrying stream_select',
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)