Example #1
0
 /**
  * @param User $user
  * @return boolean
  */
 public function sendEmailVerification(User $user)
 {
     $code = md5(rand(1, 10000) * time());
     $user->setEmailVerifyCode($code);
     $user->setEmailConfirmed(false);
     $user->commitChanges();
     $url = getUrlBase();
     $verifyUrl = $url . "/index.php?module=register&action=verifymail&k=" . $code;
     $message = sprintf("Hello %s\n\nYou, or someone has created an account on %s with this e-mail address.\n\nTo verify your account please open the web address under (or click it)\n%s\n\nSent by LANCMS to %s because the user %s was created on the site %s at %s.", $user->getFullName(), $url, $verifyUrl, $user->getEmail(), $user->getNick(), $url, date("d.m.Y H:i:s", $user->getRegisterTime()));
     mail($user->getEmail(), "Verify your user account", $message);
     return true;
 }