实现邀请专家注册及邀请专家评审的email发送
This commit is contained in:
parent
662713f0ea
commit
59400804be
|
@ -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']}'";
|
||||
|
|
Loading…
Reference in New Issue