I have imported a set of user information into drupal website and all the users are active.
Now I need to generate the password for each user and send an email to them to notify them that the account has been created.
I found the code here which shows how to update the password of the user by code.
$account = user_load(array('uid' => $userdata['uid'])); $password = user_password(); $username = $userdata['username']; $updates = array( 'pass' => $password, 'roles' => array( <rid> => '<role title>'; ), ); user_save($account, $updates);
Now how can I notify the users of their new username and password.