wp_mail_failed
Fires after a 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, attachments, and embeds.
*
* @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, attachments, and embeds.
Changelog
| Since 4.4.0 | Introduced. |
Where the hook is called
wp_mail_failed
wp-includes/pluggable.php 665
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
wp-includes/pluggable.php 455
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );