WordPress.org

Make WordPress Core

Ticket #18926: 18926.3.diff

File 18926.3.diff, 788 bytes (added by jorbin, 6 years ago)
  • src/wp-includes/pluggable.php

     
    534534        try {
    535535                return $phpmailer->Send();
    536536        } catch ( phpmailerException $e ) {
     537
     538                $mail_error_data = compact( $to, $subject, $message, $headers, $attachments );
     539                /**
     540                 * Fires after a phpmailerException is caught
     541                 *
     542                 * @since 4.4.0
     543                 *
     544                 * @param WP_Error A WP_Error object with the phpmailerException code, message and an array
     545                 *                                 containing the mail recipient, subject, message, headers and attachments
     546                 */
     547                do_action( 'wp_mail_failed', new WP_Error( $e->getCode(), $e->getMessage(), $mail_error_data ) );
     548
    537549                return false;
    538550        }
    539551}