$dbManager = new DBManager();
$userArray = $dbManager.getNewUsers();
$emailer = new Emailer();
$stats = new StatLog();

for ($i = 0; $i < count($userArray[$i]); $i++) {

   $user = $userArray[$i];
   $userPref = $user->getMailPreference();
   $userMail = $user->getEmail();

   if ($userPref == true) {
      $emailer->sendMailToUser($userMail);
   } else {
      $stats->StoreUnmailedUser($user->getID());
   }
}