Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_mail_failed

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
361           $from_name = apply_filters( 'wp_mail_from_name', $from_name );
362
363           try {
364                $phpmailer->setFrom( $from_email, $from_name, false );
365           } catch ( PHPMailer\PHPMailer\Exception $e ) {
366                $mail_error_data                             = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
367                $mail_error_data['phpmailer_exception_code'] = $e->getCode();
368
369                /** This filter is documented in wp-includes/pluggable.php */
370                do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
371
372                return false;
373           }
374
375           // Set mail's subject and body.
376           $phpmailer->Subject = $subject;
377           $phpmailer->Body    = $message;
378
379           // Set destination addresses, using appropriate methods for handling addresses.
 
Line Code
503
504                /**
505                 * Fires after a PHPMailer\PHPMailer\Exception is caught.
506                 *
507                 * @since 4.4.0
508                 *
509                 * @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
510                 *                        containing the mail recipient, subject, message, headers, and attachments.
511                 */
512                do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
513
514                return false;
515           }
516      }
517 endif;
518
519 if ( ! function_exists( 'wp_authenticate' ) ) :
520      /**
521       * Authenticate a user, confirming the login credentials are valid.