Changeset 48033 for trunk/src/wp-includes/pluggable.php
- Timestamp:
- 06/12/2020 03:45:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r47949 r48033 159 159 * @since 1.2.1 160 160 * 161 * @global PHPMailer $phpmailer161 * @global PHPMailer\PHPMailer\PHPMailer $phpmailer 162 162 * 163 163 * @param string|array $to Array or comma-separated list of email addresses to send message. … … 211 211 212 212 // (Re)create it, if it's gone missing. 213 if ( ! ( $phpmailer instanceof PHPMailer ) ) { 214 require_once ABSPATH . WPINC . '/class-phpmailer.php'; 215 require_once ABSPATH . WPINC . '/class-smtp.php'; 216 $phpmailer = new PHPMailer( true ); 213 if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) { 214 require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'; 215 require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php'; 216 require_once ABSPATH . WPINC . '/PHPMailer/Exception.php'; 217 $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true ); 217 218 } 218 219 … … 357 358 try { 358 359 $phpmailer->setFrom( $from_email, $from_name, false ); 359 } catch ( phpmailerException $e ) {360 } catch ( PHPMailer\PHPMailer\Exception $e ) { 360 361 $mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); 361 362 $mail_error_data['phpmailer_exception_code'] = $e->getCode(); … … 405 406 break; 406 407 } 407 } catch ( phpmailerException $e ) {408 } catch ( PHPMailer\PHPMailer\Exception $e ) { 408 409 continue; 409 410 } … … 456 457 // Only add custom headers not added automatically by PHPMailer. 457 458 if ( ! in_array( $name, array( 'MIME-Version', 'X-Mailer' ), true ) ) { 458 $phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 459 try { 460 $phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 461 } catch ( PHPMailer\PHPMailer\Exception $e ) { 462 continue; 463 } 459 464 } 460 465 } 461 466 462 467 if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) { 463 $phpmailer->addCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );468 $phpmailer->addCustomHeader( sprintf( 'Content-Type: %s; boundary="%s"', $content_type, $boundary ) ); 464 469 } 465 470 } … … 469 474 try { 470 475 $phpmailer->addAttachment( $attachment ); 471 } catch ( phpmailerException $e ) {476 } catch ( PHPMailer\PHPMailer\Exception $e ) { 472 477 continue; 473 478 } … … 487 492 try { 488 493 return $phpmailer->send(); 489 } catch ( phpmailerException $e ) {494 } catch ( PHPMailer\PHPMailer\Exception $e ) { 490 495 491 496 $mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); … … 493 498 494 499 /** 495 * Fires after a phpmailerException is caught.500 * Fires after a PHPMailer\PHPMailer\Exception is caught. 496 501 * 497 502 * @since 4.4.0 498 503 * 499 * @param WP_Error $error A WP_Error object with the phpmailerException message, and an array504 * @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array 500 505 * containing the mail recipient, subject, message, headers, and attachments. 501 506 */
Note: See TracChangeset
for help on using the changeset viewer.