Ticket #195 增加了通过邮件模板为专家发送邀请函的功能

This commit is contained in:
Li Jianxuan 2011-10-13 07:54:02 +00:00
parent ea5116216e
commit 34a9f7bec6
1 changed files with 21 additions and 21 deletions

View File

@ -290,47 +290,47 @@ class Admin_ReviewController extends Zend_Controller_Action
$sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')"; $sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')";
$expinfo="select realname from users where id='$v'";
$rs = $this->db->query($expinfo);
$expinfo = $rs->fetch();
try{ try{
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
if($md['status']<2) if($md['status']<2)
{ {
$update = "update mdstatus set status=2 where uuid='$uuid'"; $update = "update mdstatus set status=2 where uuid='$uuid'";
$this->db->exec($update); @$this->db->exec($update);
} }
/* $mailtp=new EmailText();
$mailbody=new emailtext(); $mailtp->db = $this->db;
$mailbody->db = $this->db;//为邮件模板类传入PDO对象 $mailtp->tmpid = "expinvite";
$mailbody->tmpid = $id;//传入模板的ID $mailtp->data = array(
'user' => $expinfo['realname'],
//设置要替换的变量 'uuid' => $uuid,
$mailbody->data = array( 'title' => $md['title']
'user' => $this->_request->getParam('user')
); );
//输出邮件正文 $body = $mailtp->loadtmp();
$body=$mailbody->loadtmp(); if($body === false)
if($body){ {
$body; $this->messenger->addMessage('模板加载失败');
}else{ $this->_redirect("/admin/review/invite/?id=$id");
$this->messenger->addMessage('模板加载出错');
$this->_redirect('');
} }
*/
$subject = "西部数据中心"; $subject = "西部数据中心-元数据评审邀请函";
$email = "la5c@qq.com"; $email = "la5c@qq.com";
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
$body="尊敬的西部数据中心用户:";
$mail->setBodyText($body); $mail->setBodyText($body);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($email); $mail->addTo($email);
$mail->setSubject($subject); $mail->setSubject($subject);
if($mail->send()) if($mail->send())
{ {
$this->messenger->addMessage('成功邀请专家:'.$rows['realname']); $this->messenger->addMessage('成功邀请专家:'.$expinfo['realname']);
}else }else
{ {
$this->messenger->addMessage('邀请专家:'.$rows['realname'].'的邮件发送失败,请尝试手动发送邀请邮件'); $this->messenger->addMessage('邀请专家'.$expinfo['realname'].'的邮件发送失败,请尝试手动发送邀请邮件');
} }
} }
}catch(Exception $e){ }catch(Exception $e){