Refresh [account:one-time-login-url] I have a module that creates a new user and automatically logs

//set up the user fields
$fields = array(
  'name' =&gt; $login,
  'mail' =&gt; $to_insert['email'],
  'pass' =&gt; user_password(10),
  'status' =&gt; 1,
  'init' =&gt; $to_insert['email'],
  'timezone' =&gt; 'Europe/Paris',
  'roles' =&gt; array(
     DRUPAL_AUTHENTICATED_RID =&gt; 'authenticated user',
  ),
);

//the first parameter is left blank so a new user is created
$user = user_save('', $fields);
user_login_finalize();


However, I want to create a rule to send the information to the new user.
I would use the token [account: one-time-login-url] but it does not work.

What for?
How to refresh this token when I create a new user?

Thanks for your help
You can handle this very easily in your module. Once you save the account and you have the user object just simply use _user_mail_notify(). As an example:

 _user_mail_notify('password_reset', $account);


If you want to alter the email in any way you can do that with hook_mail_alter() from within your custom module.