作者:Jason子宣_805 | 来源:互联网 | 2014-06-12 18:37
首先下载mail.class.php类文件,配置文件中定义下列参数:'MAIL_ADDRESS'>'ivzhu@qq.com',//邮箱地址'MAIL_SMTP'>...
首先下载mail.class.php类文件,配置文件中定义下列参数:
- 'MAIL_ADDRESS' => 'ivzhu@qq.com',
- 'MAIL_SMTP' => 'smtp.qq.com',
- 'MAIL_LOGINNAME' => 'mail@qq.com',
- 'MAIL_PASSWORD' => '123456',
- 'MAIL_CHARSET' => 'UTF-8',
- 'MAIL_AUTH' => true,
- 'MAIL_HTML' => true,
在tp项目org中放入mail.class.php,使用时候引入 import('@.ORG.Mail');
- public function index(){
- import('@.ORG.Mail');
-
-
- $content=md5(time());
- session($content,$content);
- $content=C('localurl').'/index.php'.U('Mail/index',array('res'=>$content));
- if(SendMail('aa@qq.com','nihao邮件标题',$content,'unphp')){
- echo 'chengong';
- }else{
- echo 'shibai';
- }
- $this->display();
- }
另一个页面接受参数res:
- public function index(){
- header("Content-type: text/html; charset=utf-8");
- $res=I('res');
- echo $res;
- if(session($res)==$res){
- echo '密码找回成功';
- session($res,null);
- }else{
- echo '已经过期';
- }
- }