UserModel::sendPasswordEmail PHP Method

sendPasswordEmail() public method

Send password email.
public sendPasswordEmail ( integer $UserID, string $Password )
$UserID integer
$Password string
    public function sendPasswordEmail($UserID, $Password)
    {
        $Session = Gdn::session();
        $Sender = $this->getID($Session->UserID);
        $User = $this->getID($UserID);
        $AppTitle = Gdn::config('Garden.Title');
        $Email = new Gdn_Email();
        $Email->subject('[' . $AppTitle . '] ' . t('Reset Password'));
        $Email->to($User->Email);
        $greeting = formatString(t('Hello %s!'), val('Name', $User));
        $message = '<p>' . $greeting . ' ' . sprintf(t('%s has reset your password at %s.'), val('Name', $Sender), $AppTitle) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Email'), val('Email', $User)) . '<br>' . sprintf(t('%s: %s'), t('Password'), $Password) . '</p>';
        $emailTemplate = $Email->getEmailTemplate()->setTitle(t('Reset Password'))->setMessage($message)->setButton(externalUrl('/'), t('Access the Site'));
        $Email->setEmailTemplate($emailTemplate);
        try {
            $Email->send();
        } catch (Exception $e) {
            if (debug()) {
                throw $e;
            }
        }
    }
UserModel