I am developing a simple plugin to send user's information (in the header) to a specific email right after registration.
This is what I wrote, but for some reason it does not work.
function sendemail($user_id)
{
$new_user = get_userdata($user_id);
$headers = 'From: ' . $new_user->display_name . ' <' . $new_user->user_email . '>' . "\r\n";
wp_mail('email@domain.com', 'subject', 'message', $headers);
}
// Now we set that function up to execute when the user_register action is called
add_action('user_register', 'sendemail');
Any help?