Sends the confirmation email to a user, after activating.
@param  string $code
@return bool
339563
public function attemptActivation($code)
    {
        $result = parent::attemptActivation($code);
        if ($result === false) {
            return false;
        }

        Event::fire('rainlab.user.activate', [$this]);

        return true;
    }
857234
protected function response($message, $code)
  {
    Rest::response()->json([
      'status' => $message,
      'code' => $code
    ], $code);

    cancel();
  }
884517
public function Send($confirm = false) {
		// if From was not set ...
		if ($this->From == 'root@localhost') {
			throw new \Exception(__CLASS__.'<br />The key "From" could not be found in the assigned config, but has to be set.');
		}

		// Set sender to avoid to get marked as spam
		if (empty($this->Sender)) $this -> Sender		= $this -> From;
		
		// set user to standards for developing purposes
		if (isset($this->forceTo) && is_array($this->forceTo) && count($this->forceTo)>0 ) {
			$this->ClearAllRecipients();
			foreach ($this->forceTo as $email) {
				$this->AddAddress($email, 'Development User');
			}
		}
		
		// Send mail only if confirmed
		if ($confirm === true) $returner = parent::Send();
		else {
			$dump['from']    = $this->From;
			$dump['fromName']= $this->FromName;
			$dump['to']      = $this->to;
			$dump['cc']      = $this->cc;
			$dump['bcc']     = $this->bcc;
			$dump['subject'] = $this->Subject;
			$dump['body']    = $this->Body;
			$dump['altbody'] = $this->AltBody;
			dump($dump);
			$returner = true;
		}

		if ($returner === false) {
			throw new \Exception(__CLASS__.'<br />'.$this->ErrorInfo);
		} else {
			return true;
		}
	}
1124881
protected function validateCode($code)
    {
        if (is_integer($code)) {
            return true;
        }

        // Plug it back in and see what we get
        if (is_string($code)) {
            return $this->set($code);
        }

        if (is_array($code)) {
            return $this->validateCodeArray($code);
        }

        return false;
    }
1183665
public function afterSave()
    {
        // Only send the confirmation email if emails are turned on in the config
        if ($this->getDI()->get('config')->useMail) {

            if ($this->active == 'N') {

                $emailConfirmation = new EmailConfirmations();

                $emailConfirmation->usersId = $this->id;

                if ($emailConfirmation->save()) {
                    $this->getDI()
                        ->getFlash()
                        ->notice('A confirmation mail has been sent to ' . $this->email);
                }
            }
        }
    }
823971
static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
		$text = self::getText( $code );
		header( $protocol.' '.$code.' '.$text );
	}
322433
public function setCode( $code )
	{
		$this->_checkCode( $code );

		$this->_values['code'] = (string) $code;
		$this->setModified();
	}
594404
def send_confirm_email_email(self, user, user_email):
        """"""
        
        # Verify config settings
        if not self.user_manager.USER_ENABLE_EMAIL: return
        if not self.user_manager.USER_ENABLE_CONFIRM_EMAIL: return

        # The confirm_email email is sent to a specific user_email.email or user.email
        email = user_email.email if user_email else user.email

        # Generate a confirm_email_link
        object_id = user_email.id if user_email else user.id
        token = self.user_manager.generate_token(object_id)
        confirm_email_link = url_for('user.confirm_email', token=token, _external=True)

        # Render email from templates and send it via the configured EmailAdapter
        self._render_and_send_email(
            email,
            user,
            self.user_manager.USER_CONFIRM_EMAIL_TEMPLATE,
            confirm_email_link=confirm_email_link,
        )
100694
public function shouldIgnoreErrorCode($code)
    {
        if (isset($this->errorReportingLevel)) {
            return !($this->errorReportingLevel & $code);
        }

        return !(error_reporting() & $code);
    }
59535
public function sendHttpCode($code = null)
    {
        if (func_num_args() == 0) {
            return $this->sendHttpCode;
        }

        if (!$code) {
            return $this->sendHttpCode = false;
        }

        if ($code === true) {
            $code = 500;
        }

        if ($code < 400 || 600 <= $code) {
            throw new InvalidArgumentException(
                 "Invalid status code '$code', must be 4xx or 5xx"
            );
        }

        return $this->sendHttpCode = $code;
    }
34609
public function sendCode($mobile, $code) {
        return $this->send($mobile, str_replace('{code}', $code, $this->get('template')));
    }
1289791
public function findUserByPersistenceCode($code)
    {
        $persistence = $this->findByPersistenceCode($code);

        if ($persistence)
        {
            return $persistence->getUser();
        }

        return false;
    }
234088
public function apply($code)
    {
        if (!auth()->check()) {
            throw new UnauthenticatedException;
        }

        try {
            if ($promocode = $this->check($code)) {
                if ($this->isSecondUsageAttempt($promocode)) {
                    throw new AlreadyUsedException;
                }

                $promocode->users()->attach(auth()->id(), [
                    'promocode_id' => $promocode->id,
                    'used_at' => Carbon::now(),
                ]);

                return $promocode->load('users');
            }
        } catch (InvalidPromocodeException $exception) {
            //
        }

        return false;
    }
1179160
function setCode( $code ) {
        $this->code = $code;
        $this->addHeader($this->getDefaultHeaderFromCode( $code ));
        return $this;
    }
620167
public function postSignup($code = null)
    {
        if ($code === null) {
            throw new NotFoundHttpException();
        }

        $invite = Invite::where('code', '=', $code)->first();

        if (!$invite || $invite->is_claimed) {
            throw new BadRequestHttpException();
        }

        try {
            execute(new SignupUserCommand(
                Binput::get('username'),
                Binput::get('password'),
                Binput::get('email'),
                User::LEVEL_USER
            ));
        } catch (ValidationException $e) {
            return cachet_redirect('signup.invite', [$invite->code])
                ->withInput(Binput::except('password'))
                ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.signup.failure')))
                ->withErrors($e->getMessageBag());
        }

        execute(new ClaimInviteCommand($invite));

        return cachet_redirect('status-page')
            ->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('cachet.signup.success')));
    }
28831
public function send($data, $code = 200, array $headers = [])
    {
        if (is_array($data) || $data instanceof \stdClass || is_object($data)) {
            return $this->json($data, $code, $headers);
        }

        $this->code = $code;

        foreach ($headers as $key => $value) {
            $this->addHeader($key, $value);
        }

        $this->content = $data;

        return $this->buildHttpResponse();
    }
1135575
public function onActivate($code = null)
    {
        try {
            $code = post('code', $code);

            $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')];

            /*
             * Break up the code parts
             */
            $parts = explode('!', $code);
            if (count($parts) != 2) {
                throw new ValidationException($errorFields);
            }

            list($userId, $code) = $parts;

            if (!strlen(trim($userId)) || !strlen(trim($code))) {
                throw new ValidationException($errorFields);
            }

            if (!$user = Auth::findUserById($userId)) {
                throw new ValidationException($errorFields);
            }

            if (!$user->attemptActivation($code)) {
                throw new ValidationException($errorFields);
            }

            Flash::success(Lang::get(/*Successfully activated your account.*/'rainlab.user::lang.account.success_activation'));

            /*
             * Sign in the user
             */
            Auth::login($user);

        }
        catch (Exception $ex) {
            if (Request::ajax()) throw $ex;
            else Flash::error($ex->getMessage());
        }
    }