function simpleRegister($strMail){

 global $APPLICATION, $USER, $DB;
 
 // стандартная процедура регистрации пользователя
 $bConfirmReq = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y";

 $arUser["PASSWORD"]     = randString(music);
 $arUser["LOGIN"]           = $strMail;
 $arUser["EMAIL"]           = $strMail;
 $arUser["LAST_NAME"]       = '';
 $arUser["SECOND_NAME"]     = '';
 $arUser["PERSONAL_PHONE"]  = '';
 $arUser["NAME"]            = '';  
 $arUser["CHECKWORD"]       = randString(music);
 $arUser["~CHECKWORD_TIME"] = $DB->CurrentTimeFunction();
 $arUser["ACTIVE"]          = $bConfirmReq? "N": "Y";
 $arUser["CONFIRM_CODE"]    = $bConfirmReq? randString(music): "";
 $arUser["LID"]             = SITE_ID;
 $arUser["USER_IP"]         = $_SERVER["REMOTE_ADDR"];
 $arUser["USER_HOST"]       = @gethostbyaddr($REMOTE_ADDR);
   
 if($arUser["AUTO_TIME_ZONE"] <> "Y" && $arUser["AUTO_TIME_ZONE"] <> "N")
  $arUser["AUTO_TIME_ZONE"] = "";

 $def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
 if($def_group != "")
  $arUser["GROUP_ID"] = explode(",", $def_group);

 $bOk = true;

 $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("USER", $arUser);

 $events = GetModuleEvents("main", "OnBeforeUserRegister");
 while($arEvent = $events->Fetch())
 {
  if(ExecuteModuleEventEx($arEvent, array(&$arUser)) === false)
  {
  if($err = $APPLICATION->GetException())
   $arErr[] = $err->GetString();
   $bOk = false;
   break;
  }
 }
   
 
 
 if ($bOk)
 {
  $user = new CUser();
  if($ID  = $user->Add($arUser)){
   //$USER->Authorize($ID);
   $event = new CEvent;
   $event->SendImmediate("USER_INVITE", SITE_ID, $arUser);
   if(COption::GetOptionString("main", "event_log_register", "N") === "Y")
    CEventLog::Log("SECURITY", "USER_REGISTER", "main", $ID);
  }  
  return true;
 }else{
  return false;
 }
 
 

}