Sends an email with a link, for resetting the password.

@return boolean whether the email was send
434559
public function sendEmail()
    {
        /* @var $user User */
        $user = User::findOne([
            'status' => User::STATUS_ACTIVE,
            'email' => $this->email,
        ]);

        if ($user) {
            if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
                $user->generatePasswordResetToken();
            }

            if ($user->save()) {
                $resetUrl = $this->resetUrl;
                $resetUrl['token'] = $user->password_reset_token;
                return Yii::$app->mailer->compose($this->mailView, ['user' => $user, 'resetUrl' => $resetUrl])
                    ->setTo($this->email)
                    ->setSubject(Yii::t('maddoger/user', 'Password reset for {app}', ['app' => \Yii::$app->name]))
                    ->send();
            }
        }

        return false;
    }
701979
protected function _send()
	{
		// Build the message
		$message = $this->build_message();

		// Open a connection
		$return_path = ($this->config['return_path'] !== false) ? $this->config['return_path'] : $this->config['from']['email'];
		$handle = @popen($this->config['sendmail_path'] . " -oi -f ".$return_path." -t", 'w');

		// No connection?
		if(! is_resource($handle))
		{
			throw new \SendmailConnectionException('Could not open a sendmail connection at: '.$this->config['sendmail_path']);
		}

		// Send the headers
		fputs($handle, $message['header']);

		// Send the body
		fputs($handle, $message['body']);

		if(pclose($handle) === -1)
		{
			throw new \SendmailFailedException('Failed sending email through sendmail.');
		}

		return true;
	}
1059781
public function sendEmail($email)
    {
        $user = $this->users->where('email', $email)->first();

        if (! is_null($user)) {
            $user->generatePasswordResetToken();
        }
    }
749955
public function actionResetPassword()
    {
        /** @var User $user */
        $user = null;
        
        while (empty($user)) {
            $email = $this->email ?: $this->prompt('User E-Mail:');
            $user = User::findByEmail($email);
            if (empty($user)) {
                $this->outputError('The provided E-Mail not found in the System.');
            }
        }
    
        $password = $this->password ?: $this->prompt('User Password:');
    
        if ($this->confirm("Are you sure to change the password of User '$email'?") !== true) {
            return $this->outputError('Abort password change process.');
        }
        
        $user->password_salt = Yii::$app->getSecurity()->generateRandomString();
        $user->password = Yii::$app->getSecurity()->generatePasswordHash($password.$user->password_salt);
        if ($user->save(true, ['password', 'password_salt'])) {
            return $this->outputSuccess("The password for user ($email) has been changed.");
        }
    
        return $this->outputError("The password could not changed.\n" . implode("\n", $user->firstErrors));
    }
859205
public function sendEmail()
    {
        
        $identityClass = \Yii::$app->user->identityClass;
        /* @var $user User */
        $user = $identityClass::findOne([
                    //  'status' => $identityClass::STATUS_ACTIVE,
                    'email' => $this->email,
        ]);

        if (!$user) {

            return false;
        }

        if (!$identityClass::isPasswordResetTokenValid($user->password_reset_token)) {

            $user->generatePasswordResetToken();
        }

        if (!$user->save()) {
     
            return false;
        }

        return Yii::$app
                        ->mailer
                        ->compose(
                                ['html' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-html', 'text' => '@vendor/humanized/yii2-advanced-application-template-user/mail/passwordResetToken-text'], ['user' => $user]
                        )
                        ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
                        ->setTo($this->email)
                        ->setSubject('Password ' . ($user->status != 0 ? 're' : '') . 'set for ' . Yii::$app->name)
                        ->send();
    }
67335
function sendPasswordResetEmail() {

  return application.sendPasswordResetEmail(accountEmail, function(err, token) {
    if (err) throw err;

    console.log("Sent email that included a link with password reset token: " + token.toString());
    console.log("If you like, go to mailinator.com and use this email address to view the email: " + accountEmail);

    //ok, moving on with the quickstart:
    return createGroup();
  });
}
23063
public function resetPassword()
    {
        $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
        $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
        $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
        $this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
    }
740825
public function send()
    {
        $this->validate();

        $settings = array();
        $settings['helo_hostname'] = $this->_helo_hostname;
        if ($this->_auth) {
            $settings['username'] = $this->_user;
            $settings['password'] = $this->_pass;
        }
        $settings['secure'] = $this->_secure;

        try {
            if (!is_a($this->_SMTP, 'SMTP')) {
                $this->_SMTP = new SMTP($this->_host, $this->_port, $settings);
            }

            // Encode recipient names (but not any numeric array indexes)
            $recipients = array();
            foreach ($this->_recipients as $name => $email) {
                // Support Bcc header
                if (isset($this->_header_fields['Bcc']) && $this->_header_fields['Bcc'] == $email) {
                    continue;
                }

                // if the key is not numeric, qEncode the key.
                $name = General::intval($name) > -1 ? General::intval($name) : EmailHelper::qEncode($name);
                $recipients[$name] = $email;
            }

            // Combine keys and values into a recipient list (name <email>, name <email>).
            $recipient_list = EmailHelper::arrayToList($recipients);

            // Encode the subject
            $subject = EmailHelper::qEncode((string)$this->_subject);

            // Build the 'From' header field body
            $from = empty($this->_sender_name)
                    ? $this->_sender_email_address
                    : EmailHelper::qEncode($this->_sender_name) . ' <' . $this->_sender_email_address . '>';

            // Build the 'Reply-To' header field body
            if (!empty($this->_reply_to_email_address)) {
                $reply_to = empty($this->_reply_to_name)
                            ? $this->_reply_to_email_address
                            : EmailHelper::qEncode($this->_reply_to_name) . ' <'.$this->_reply_to_email_address.'>';
            }

            if (!empty($reply_to)) {
                $this->_header_fields = array_merge(
                    $this->_header_fields,
                    array(
                        'Reply-To' => $reply_to,
                    )
                );
            }

            // Build the body text using attachments, html-text and plain-text.
            $this->prepareMessageBody();

            // Build the header fields
            $this->_header_fields = array_merge(
                $this->_header_fields,
                array(
                    'Message-ID'   => sprintf('<%s@%s>', md5(uniqid()), HTTP_HOST),
                    'Date'         => date('r'),
                    'From'         => $from,
                    'Subject'      => $subject,
                    'To'           => $recipient_list,
                    'MIME-Version' => '1.0'
                )
            );

            // Set header fields and fold header field bodies
            foreach ($this->_header_fields as $name => $body) {
                $this->_SMTP->setHeader($name, EmailHelper::fold($body));
            }

            // Send the email command. If the envelope from variable is set, use that for the MAIL command. This improves bounce handling.
            $this->_SMTP->sendMail(is_null($this->_envelope_from)?$this->_sender_email_address:$this->_envelope_from, $this->_recipients, $this->_body);

            if ($this->_keepalive === false) {
                $this->closeConnection();
            }

            $this->reset();
        } catch (SMTPException $e) {
            throw new EmailGatewayException($e->getMessage());
        }

        return true;
    }
1203076
public function sendEmail()
    {
        /* @var $user User */
        $user = User::findOne([
            'status' => User::STATUS_ACTIVE,
            'email' => $this->email,
        ]);

        if ($user) {
            if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
                $user->generatePasswordResetToken();
            }

            if ($user->save()) {


                \Yii::$app->mailer->view->theme->pathMap = ArrayHelper::merge(\Yii::$app->mailer->view->theme->pathMap,
                    [
                        '@app/mail' =>
                            [
                                '@skeeks/cms/mail-templates'
                            ]
                    ]);

                return \Yii::$app->mailer->compose('@app/mail/password-reset-token', ['user' => $user])
                    ->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ' robot'])
                    ->setTo($this->email)
                    ->setSubject(\Yii::t('skeeks/cms', 'Password reset for ') . \Yii::$app->cms->appName)
                    ->send();
            }
        }

        return false;
    }
608624
public function sendEmail()
    {
        $user = UserModel::findOne(['status' => UserStatus::ACTIVE, 'email' => $this->email]);

        if (!empty($user)) {
            $user->generatePasswordResetToken();
            if ($user->save()) {
                return Yii::$app->mailer->compose('passwordResetToken', ['user' => $user])
                    ->setFrom([Yii::$app->params['adminEmail'] => Yii::$app->name])
                    ->setTo($this->email)
                    ->setSubject(Yii::t('yii2mod.user', 'Password reset for {0}', Yii::$app->name))
                    ->send();
            }
        }

        return false;
    }
292259
final public function send()
    {
        if (!Str::equalIgnoreCase($this->_sendMethod, App::$Request->getMethod())) {
            return false;
        }

        return $this->getRequest('submit', $this->_sendMethod) !== null;
    }
736168
public function send()
    {
        $contactFormBridge = $this->getContainer()->get(ContactFormBridgeInterface::class);

        $form = $contactFormBridge->getContactForm();
        $form->handleRequest($this->getMappedContactFormRequest());

        if ($form->isValid()) {
            $this->sendContactMail(
                $form->email->getValue(),
                $form->subject->getValue(),
                $contactFormBridge->getContactFormMessage($form)
            );
        } else {
            foreach ($form->getErrors() as $error) {
                Registry::getUtilsView()->addErrorToDisplay($error);
            }

            return false;
        }
    }
321537
public function postReset()
    {
        $input = Binput::only('email');

        $val = UserRepository::validate($input, array_keys($input));
        if ($val->fails()) {
            return Redirect::route('account.reset')->withInput()->withErrors($val->errors());
        }

        $this->throttler->hit();

        try {
            $user = Credentials::getUserProvider()->findByLogin($input['email']);

            $code = $user->getResetPasswordCode();

            $mail = [
                'link'    => URL::route('account.password', ['id'    => $user->id, 'code'    => $code]),
                'email'   => $user->getLogin(),
                'subject' => Config::get('app.name').' - Password Reset Confirmation',
            ];

            Mail::queue('credentials::emails.reset', $mail, function ($message) use ($mail) {
                $message->to($mail['email'])->subject($mail['subject']);
            });

            return Redirect::route('account.reset')
                ->with('success', 'Check your email for password reset information.');
        } catch (UserNotFoundException $e) {
            return Redirect::route('account.reset')
                ->with('error', 'That user does not exist.');
        }
    }
554782
public function Send()
    {
        try {
            if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
                throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
            }

            // Set whether the message is multipart/alternative
            if (!empty($this->AltBody)) {
                $this->ContentType = 'multipart/alternative';
            }

            $this->error_count = 0; // reset errors
            $this->SetMessageType();
            $header = $this->CreateHeader();
            $body   = $this->CreateBody();

            if (empty($this->Body)) {
                throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
            }

            // Choose the mailer and send through it
            switch ($this->Mailer) {
                case 'smtp':
                    return $this->SmtpSend($header, $body);
                    break;
                case 'sendmail':
                    return $this->SendmailSend($header, $body);
                    break;
                case 'mail':
                    break;
                default:
                    return $this->MailSend($header, $body);
            }
        } catch (phpmailerException $e) {
            $this->SetError($e->getMessage());
            if ($this->exceptions) {
                throw $e;
            }
            echo $e->getMessage() . "\n";
            return false;
        }
    }
645112
public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
            ? $this->sendResetLinkResponse($request, $response)
            : $this->sendResetLinkFailedResponse($request, $response);
    }
1123387
public function toMail()
    {
        return (new MailMessage())
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password', url(config('app.url').route('platform.password.reset', $this->token, false)))
            ->line('If you did not request a password reset, no further action is required.');
    }
828307
public function postForgot()
    {
        try
        {
            $email = Input::get('email');
            $this->passForm->forgot($email);
            return View::make(Config::get('cpanel::views.password_send'))
                ->with('email', $email);
        }
        catch (UserNotFoundException $e)
        {
            return Redirect::back()
                ->with('password_error', $e->getMessage());
        }
    }