// define the wp_mail_failed callback
function action_wp_mail_failed($wp_error)
{
return error_log(print_r($wp_error, true));
}
// add the action
add_action('wp_mail_failed', 'action_wp_mail_failed', 10, 1);
I personally use slack’s webhooks and other methods for this notification.
Reference:
