Exemplo n.º 1
0
 /**
  * Send e-mail notification about user signup.
  *
  * @global Language $_LANG Global language object.
  * @param User $user Registered User object.
  *
  * @return boolean Returns TRUE if the mail was successfully accepted for
  *           delivery, FALSE otherwise.
  * @throws \Exception If users e-mail is invalid.
  */
 public function sendSignUpNotification($user)
 {
     global $_LANG;
     if (!Validator::isEmail($user->email)) {
         throw new \Exception("Invalid email: '" . $user->email . "'");
     }
     return $this->sendNotification($user->email, "You registered successfully", $_LANG->code, "signup_email", array('user_id' => $user->id, 'username' => $user->username), Email::FORMAT_HTML);
 }
Exemplo n.º 2
0
 /**
  * Email class constructor. Initialize basic e-mail send functionality
  * variables and validate from e-mail address.
  *
  * @param string $fromEmail From e-mail address.
  * @param string $fromName From name.
  * @param string $tplFolder Absolute path to the e-mail templates folder
  *           with ending '/'.
  * @param string $signatureTpl Filename of the e-mail signature template
  *           (must be in e-mail templates folder).
  *
  * @throws Exception If provided sender e-mail address is invalid.
  */
 public function __construct($fromEmail, $fromName, $tplFolder, $signatureTpl = "")
 {
     if (!Validator::isEmail($fromEmail)) {
         throw new \Exception("Invalid from e-mail address");
     }
     $this->fromEmail = $fromEmail;
     $this->fromName = $fromName;
     $this->tplFolder = $tplFolder;
     $this->signatureTpl = $signatureTpl;
 }