wp_mail_failed

wp_mail_failed

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.5.2

do_action('wp_mail_failed') is found 2 times:

  • /wp-includes/pluggable.php line 414
    			$mail_error_data                             = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
    			$mail_error_data['phpmailer_exception_code'] = $e->getCode();
    
    			/** This filter is documented in wp-includes/pluggable.php */
    			do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
    
    			return false;
    		}
    
    		// Set mail's subject and body.
    		$phpmailer->Subject = $subject;
    
  • /wp-includes/pluggable.php line 581
    			 *
    			 * @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
    			 *                        containing the mail recipient, subject, message, headers, and attachments.
    			 */
    			do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
    
    			return false;
    		}
    	}
    endif;
    
    

See this hook used in plugins:

Examples using wp_mail_failed