wp_mail_failed
Fires after a PHPMailer\PHPMailer\Exception is caught.
Usage
add_action( 'wp_mail_failed', 'wp_kama_mail_failed_action' ); /** * Function for `wp_mail_failed` action-hook. * * @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. * * @return void */ function wp_kama_mail_failed_action( $error ){ // action... }
- $error(WP_Error)
- A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array containing the mail recipient, subject, message, headers, and attachments.
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
wp_mail_failed
wp-includes/pluggable.php 581
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
wp-includes/pluggable.php 414
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );