It was achieved using two hooks.
retrieve_password_notification_email
retrieve_password_message
function ashad_retrieve_password_notification_email($defaults) {
$defaults['headers'] = array('Content-Type: text/html; charset=UTF-8');
return $defaults;
}
add_filter('retrieve_password_notification_email', 'ashad_retrieve_password_notification_email', 10, 3);
function ashad_reset_password_message($message, $key, $user_login, $user_data ) {
$user_fullname = $user_data->user_firstname . ' ' . $user_data->user_last_name;
$blog_name = get_bloginfo('name');
$reset_url = network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login');
ob_start();
include(get_stylesheet_directory() . '/templates/mail/password-change.php');
$message = ob_get_clean();
return $message;
}
add_filter("retrieve_password_message", "ashad_reset_password_message", 99, 4);
retrieve_password_notification_email
hook is used to set the header of the email as HTML and the retrieve_password_message
hook is used to set the message from the password-change.php
template file.