title: Send the reset password email notifications programatically in Woocommerce
body: <p>I would like to send the reset password email to the automatically registered guests after their first order on my woocommerce website. </p>
  
  <p>Here is my hooked function:</p>
  
  <pre><code>function wc_register_guests($order_id) {
      // get all the order data
      $order = new WC_Order($order_id);
  
      //get the user email from the order
      $order_email = $order-&gt;billing_email;
  
      // check if there are any users with the billing email as user or email
      $email = email_exists($order_email);
      $user = username_exists($order_email);
  
      // if the UID is null, then it's a guest checkout
      if ($user == false &amp;&amp; $email == false) {
  
          $random_password = wp_generate_password();
  
          // create new user with email as username &amp; newly created pw
          $user_id = wp_create_user($order_email, $random_password, $order_email);
  
          //WC guest customer identification
          update_user_meta($user_id, 'guest', 'yes');
  
          //user's billing data
          update_user_meta($user_id, 'billing_address_1', $order-&gt;billing_address_1);
          update_user_meta($user_id, 'billing_address_2', $order-&gt;billing_address_2);
          update_user_meta($user_id, 'billing_city', $order-&gt;billing_city);
          update_user_meta($user_id, 'billing_company', $order-&gt;billing_company);
          update_user_meta($user_id, 'billing_country', $order-&gt;billing_country);
          update_user_meta($user_id, 'billing_email', $order-&gt;billing_email);
          update_user_meta($user_id, 'billing_first_name', $order-&gt;billing_first_name);
          update_user_meta($user_id, 'billing_last_name', $order-&gt;billing_last_name);
          update_user_meta($user_id, 'billing_phone', $order-&gt;billing_phone);
          update_user_meta($user_id, 'billing_postcode', $order-&gt;billing_postcode);
          update_user_meta($user_id, 'billing_state', $order-&gt;billing_state);
  
          // user's shipping data
          update_user_meta($user_id, 'shipping_address_1', $order-&gt;shipping_address_1);
          update_user_meta($user_id, 'shipping_address_2', $order-&gt;shipping_address_2);
          update_user_meta($user_id, 'shipping_city', $order-&gt;shipping_city);
          update_user_meta($user_id, 'shipping_company', $order-&gt;shipping_company);
          update_user_meta($user_id, 'shipping_country', $order-&gt;shipping_country);
          update_user_meta($user_id, 'shipping_first_name', $order-&gt;shipping_first_name);
          update_user_meta($user_id, 'shipping_last_name', $order-&gt;shipping_last_name);
          update_user_meta($user_id, 'shipping_method', $order-&gt;shipping_method);
          update_user_meta($user_id, 'shipping_postcode', $order-&gt;shipping_postcode);
          update_user_meta($user_id, 'shipping_state', $order-&gt;shipping_state);
  
          wc_update_new_customer_past_orders($user_id);
      }
  }
  add_action('woocommerce_thankyou', 'wc_register_guests', 10, 1);
  </code></pre>