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