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:
- 'Mail _ address' => 'ivzhu @ qq.com ', // email ADDRESS
- 'Mail _ SMTP '=> 'smtp .qq.com', // MAIL smtp server
- 'Mail _ loginname' => 'Mail @ qq.com ', // email logon account
- 'Mail _ password' => '123', // email PASSWORD
- 'Mail _ charset' => 'utf-8', // encoding
- 'Mail _ auth' => true, // email authentication
- '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 ');
- Public function index (){
- Import ('@. ORG. mail ');
- // SendMail ('admin @ waikucms.com ', 'Email title', 'Email body', 'cool CMS Postmaster ');
- // Explain the following parameters: parameter 1 --- target mailbox, parameter 2 ---- Mail title, parameter 3 -- Mail body, parameter 4 --- 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 email title', $ content, 'unphp ')){
- Echo 'chengong ';
- } Else {
- Echo 'shibai ';
- }
- $ This-> display ();
- }
The other page accepts the parameter res:
- Public function index (){
- Header ("Content-type: text/html; charset = utf-8 ");
- $ Res = I ('res ');
- Echo $ res;
- If (session ($ res) ==$ res ){
- Echo 'password Retrieved successfully ';
- Session ($ res, null );
- } Else {
- Echo 'expired ';
- }
- }