Thinkphp email password retrieval function

Source: Internet
Author: User
First download mail. class. the following parameters are defined in the configuration file: & amp; #39; MAIL_ADDRESS & amp; #39; & gt; & amp; #39; ivzhu@qq.com & amp; #39;, // email address & amp; #39; MAIL_SMTP & amp; #39; & gt ;...

First download the mail. class. php class file, and define the following parameters in the configuration file:

  1. 'Mail _ address' => 'ivzhu @ qq.com ', // email ADDRESS
  2. 'Mail _ SMTP '=> 'smtp .qq.com', // MAIL smtp server
  3. 'Mail _ loginname' => 'Mail @ qq.com ', // email logon account
  4. 'Mail _ password' => '123', // email PASSWORD
  5. 'Mail _ charset' => 'utf-8', // encoding
  6. 'Mail _ auth' => true, // email authentication
  7. 'Mail _ HTML '=> true, // true HTML format false TXT format

Put mail. class. php in the tp project org and import ('@. ORG. mail') when using it ');

  1. Public function index (){
  2. Import ('@. ORG. mail ');
  3. // SendMail ('admin @ waikucms.com ', 'Email title', 'Email body', 'cool CMS Postmaster ');
  4. // Explain the following parameters: parameter 1 --- target mailbox, parameter 2 ---- Mail title, parameter 3 -- Mail body, parameter 4 --- sender name;
  5. $ Content = md5 (time ());
  6. Session ($ content, $ content );
  7. $ Content = C ('localurl'). '/index. php'. U ('mail/Index', array ('res' => $ content ));
  8. If (SendMail ('AA @ qq.com ', 'nihao email title', $ content, 'unphp ')){
  9. Echo 'chengong ';
  10. } Else {
  11. Echo 'shibai ';
  12. }
  13. $ This-> display ();
  14. }

The other page accepts the parameter res:

  1. Public function index (){
  2. Header ("Content-type: text/html; charset = utf-8 ");
  3. $ Res = I ('res ');
  4. Echo $ res;
  5. If (session ($ res) ==$ res ){
  6. Echo 'password Retrieved successfully ';
  7. Session ($ res, null );
  8. } Else {
  9. Echo 'expired ';
  10. }
  11. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.