Programmatic user registration not forcing user to activate account
You can use the LoginToboggan Prevent preauth module is available for Drupal 6 and 7.
And it realy does all the stuff. We can have "Email account activation without admin approval and also a user set password".

Code:

    $new_user = array(
      'name' =&gt; $username,
      'pass' =&gt; $password, 
      'mail' =&gt; $email,
      'status' =&gt; 1,
      'init' =&gt; $email,
      'roles' =&gt; array(logintoboggan_validating_id() =&gt; TRUE)
    );  
   $account = user_save(NULL, $new_user);
   // Send mail with account confirmation
   _user_mail_notify('register_no_approval_required', $account);


P.S. Don't forgot to uncheck 'Immediate login' option.