Ticket #53826: 53826.diff
| File 53826.diff, 1.8 KB (added by , 4 years ago) |
|---|
-
src/wp-includes/pluggable.php
537 537 */ 538 538 do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); 539 539 540 $mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); 541 540 542 // Send! 541 543 try { 542 return $phpmailer->send(); 543 } catch ( PHPMailer\PHPMailer\Exception $e ) { 544 $send = $phpmailer->send(); 544 545 545 $mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); 546 $mail_error_data['phpmailer_exception_code'] = $e->getCode(); 546 /** 547 * Fires after PHPMailer has successfully sent a mail. 548 * 549 * The firing of this action does not necessarily mean that the recipient received the 550 * email successfully. It only means that the `send` method above was able to 551 * process the request without any errors. 552 * 553 * @since 5.9.0 554 * 555 * @param array $mail_data An array containing the mail recipient, subject, message, headers, and attachments. 556 */ 557 do_action( 'wp_mail_succeeded', $mail_data ); 547 558 559 return $send; 560 } catch ( PHPMailer\PHPMailer\Exception $e ) { 561 $mail_data['phpmailer_exception_code'] = $e->getCode(); 548 562 /** 549 563 * Fires after a PHPMailer\PHPMailer\Exception is caught. 550 564 * … … 553 567 * @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array 554 568 * containing the mail recipient, subject, message, headers, and attachments. 555 569 */ 556 do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_ error_data ) );570 do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) ); 557 571 558 572 return false; 559 573 }