thinkphp Implement send mail password back function instance, thinkphp password Retrieve
This paper describes the method of thinkphp to realize the function of sending mail password retrieval. Share to everyone for your reference. The implementation method is as follows:
First download the mail.class.php class file, and the following parameters are defined in the configuration file:
Copy CodeThe code is as follows: ' mail_address ' = ' ivzhu@qq.com ',//email address
' Mail_smtp ' = ' smtp.qq.com ',//mailbox SMTP Server
' Mail_loginname ' = ' mail@qq.com ',//Email login account
' Mail_password ' = ' 123456 ',//email password
' Mail_charset ' = ' UTF-8 ',//coded
' Mail_auth ' = true,//email authentication
' mail_html ' = = True,//true HTML format false txt format
In the TP project ORG put mail.class.php, use time to introduce import (' @.org.mail ');
Copy CodeThe code is as follows: Public Function index () {
Import (' @.org.mail ');
SendMail (' admin@waikucms.com ', ' mail header ', ' Message body ', ' crooked cool CMS admin ');
Explain the following parameters: Parameter 1---target mailbox, parameter 2----message header, parameter three--message body, parameter four---sender name;
$content =md5 (Time ());
Session ($content, $content);
$content =c (' Localurl '). ' /index.php '. U (' Mail/index ', Array (' res ' = = $content));
if (SendMail (' aa@qq.com ', ' Nihao mail header ', $content, ' unphp ')) {
Echo ' Chengong ';
}else{
Echo ' Shibai ';
}
$this->display ();
}
Another page accepts the parameter res:
Copy CodeThe code is as follows: Public Function index () {
Header ("content-type:text/html; Charset=utf-8 ");
$res =i (' res ');
Echo $res;
if (session ($res) = = $res) {
Echo ' Password recovered successfully ';
session ($res, NULL);
}else{
Echo ' has expired ';
}
}
It is hoped that this article will be helpful to everyone's thinkphp framework design.
http://www.bkjia.com/PHPjc/920623.html www.bkjia.com true http://www.bkjia.com/PHPjc/920623.html techarticle thinkphp Implement send mail password retrieve function instance, thinkphp password Retrieve the example of this article tells the thinkphp realizes the method of sending the mail password retrieve function. Share to everyone for your reference. ...