currently using this plugin https://wordpress.org/plugins/wp-rest-user/ and there is a section where if you want to send a user an email when he/she registers (using wordpress as a headless CMS)
add_action('wp_rest_user_user_register', 'user_registered');
function user_registered($user) {
// Do Something
}
already set up WP Mail SMTP plugin so it overrides the wp_mail function
the question is: how can I get the email of the registered user to send him/her an email using the wp_mail function ?
$user
is you're getting passed? If it is an object of theWP_User
class, it should be trivial to get their mail address.