Use Phpmailer to send mail, and realize forgot password find add function code, the need for friends, you can refer to the next. To achieve the following functions: 1, according to the mail back link into the Reset Password operation page. Only one week, one effective 2, reset password (you can also send password directly login) 1. Generate mail to retrieve mail
Hello! According to your on [". Date (' y-m-d h:m:s '). "], this message will guide you to reset ["]. $account. "] Password for the account. If you confirm that the "Reset password" request is submitted by you yourself, please click here to complete the reset operation (this link is only one week, once valid). If the above link is not clickable, you can also copy the following link, paste it into your browser's address bar, and then press "enter" to open the Reset secret Question page to set up a new secret question and answer: {$url} If you have not submitted a "Reset password" request at these points, it is possible that your secret question is a The case has been compromised and a malicious user is trying to steal your account! "; SendMail ($subject, $body, $address); function SendMail ($subject, $body, $address) {$mail = new Phpmailer (); $mail->charset = ' utf-8 '; $mail->ishtml (TRUE); Set the message format to HTML $mail->issendmail (); Use Linux sendmail to send mail $mail->host = web_site_host; Specify main and Backup server $mail->smtpauth = true; Set to secure authentication method $mail->setlanguage (' en ', path_class. ' /phpmailer/language/'); $mail->from = Mail_sender; $mail->fromname = "service"; $mail->addaddress ($address); Recipient address $mail->wordwrap = 50; Set word wrap toCharacters $mail->subject = $subject; $mail->body = Daddslashes ($body, 1); $result = $mail->send (); if (! $result) {echo $mail->errorinfo; } $mail->smtpclose (); return $result; }//Mail link validity check function resetpass ($mapping, $form, & $request, & $response) {$use _id = $request GetParameter (' u '); $user = $this->delegate->getuserinfo_byid ($use _id); $o _mail = $user [' email ']; $o _account = $user [' account ']; $auth = $request->getparameter (' auth '); $auth = Authcode ($auth, ' DECODE ', ' safeemail '); $n _auth = $use _id. $o _account. $o _mail; $a = false; if ($n _auth = = $auth) {$a = true; } $form->setedituser ($user); if ($a) {//valid return $mapping->findforwardconfig (' resetpwd '); }}?> class.phpmailer.php Line 332 recursive call, mass mailing
$value) { $this->addmutieaddress ($value); } } else{ $this->addaddress ($arrAddress); } } ? >
The first use of Gmail failed Smtpsecure=ssl. Phpmailer sending HTML style missing resolution: cannot use a style with a path Use |