From 59400804be47201a40f001d138151f9d42abdcd4 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 13 Oct 2011 12:58:57 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=82=80=E8=AF=B7=E4=B8=93?= =?UTF-8?q?=E5=AE=B6=E6=B3=A8=E5=86=8C=E5=8F=8A=E9=82=80=E8=AF=B7=E4=B8=93?= =?UTF-8?q?=E5=AE=B6=E8=AF=84=E5=AE=A1=E7=9A=84email=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/ReviewController.php | 49 ++++--------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index 8d242c31..e46f7e6f 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -290,7 +290,7 @@ class Admin_ReviewController extends Zend_Controller_Action $sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')"; - $expinfo="select realname from users where id='$v'"; + $expinfo="select realname,email from users where id='$v'"; $rs = $this->db->query($expinfo); $expinfo = $rs->fetch(); @@ -302,31 +302,13 @@ class Admin_ReviewController extends Zend_Controller_Action $update = "update mdstatus set status=2 where uuid='$uuid'"; @$this->db->exec($update); } - - $mailtp=new EmailText(); //实例化EmailText - $mailtp->db = $this->db; //传入PDO类型数据库对象 - $mailtp->tmpid = "expinvite"; //传入模板ID或标示符,传入ID是使用int类型 - $mailtp->data = array( //传入要替换的数据 - 'user' => $expinfo['realname'], //用户名 {user} - 'uuid' => $uuid, //uuid {uuid} - 'title' => $md['title'] //元数据标题 {title} - ); - $body = $mailtp->loadtmp(); //加载模板 - $subject = $mailtp->tmpinfo['subject']; //标题(顺序不能变,必须先加载模板后调用标题,减少数据库查询的次数) - - if($body === false) - { - $this->messenger->addMessage('模板加载失败'); - $this->_redirect("/admin/review/invite/?id=$id"); - } - - $email = "la5c@qq.com"; - + //实例化EmailText + $mailtp=new EmailText($this->db,'invite-expert-review',array('user'=>$expinfo['realname'],'uuid'=>$uuid,'title'=>$md['title'])); $mail=new WestdcMailer($this->view->config->smtp); - $mail->setBodyText($body); + $mail->setBodyText($mailtp->getBody()); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mail->addTo($email); - $mail->setSubject($subject); + $mail->addTo($expinfo['email']); + $mail->setSubject($mailtp->getSubject()); if($mail->send()) { $this->messenger->addMessage('成功邀请专家:'.$expinfo['realname']); @@ -656,23 +638,12 @@ class Admin_ReviewController extends Zend_Controller_Action if($this->db->insert('users',$data)) { - $mail=new WestdcMailer($this->view->config->smtp); - $body="尊敬的西部数据中心用户: - 您已经成功注册,请妥善保管您的账号信息 - - 用户名:$username - - 密码: $password - - 感谢您的注册 - - 西部数据中心服务组"; - - $body.=""; - $mail->setBodyText($body); + $mail=new WestdcMailer($this->view->config->smtp); + $mailtp=new EmailText($this->db,'expert-register',array('user'=>$username,'password'=>$password)); + $mail->setBodyText($mailtp->getBody()); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->addTo($email); - $mail->setSubject('欢迎注册成为西部数据中心用户'); + $mail->setSubject($mailtp->getSubject()); $mail->send(); $sql="select id from users where username='{$data['username']}'";