/** * 发送邮件 */ public function send() { $email = $this->input['email']; $template_name = $this->input['template_name']; $content = $this->input['content']; $from = $this->input['from']; $fromname = $this->input['fromname']; //发送邮件 $sendCloud = new DDSendCloud($template_name); $ret = $sendCloud->sendTo(array('to' => $email, 'content' => $content, 'from' => $from, 'fromname' => $fromname)); $this->addItem($ret); $this->output(); }
/** * 发送邮箱验证码 */ private function sendemail($email, $code) { if (!$code) { $this->errorOutput(PARAM_WRONG); } $user = new dingdone_user_mode(); $condition = " AND email='" . $email . "'"; $user_info = $user->getUserByCond($condition); //准备发送邮件 $preg = array('{username}', '{code}'); //产生一个用于邮箱验证的识别码 $replace = array($user_info['user_name'], $code); $htmlBody = file_get_contents(ROOT_DIR . 'email/find_password.html'); $content = str_replace($preg, $replace, $htmlBody); //发送邮件 $sendCloud = new DDSendCloud('find_password'); $ret = $sendCloud->sendTo(array('to' => $email, 'content' => $content)); return $ret; }
//发送邮件 if (!$this->sendActivateEmail($user_info, $this->input['new_email'])) { $this->errorOutput(EMAIL_SEND_FAIL); } $this->addItem(array('return' => 1)); $this->output(); } /***************************************修改某人的邮箱,只针对没有激活的邮箱***************************************/ /***************************************修改某人的邮箱,正常的修改***********************************************/ public function changeEmail() { $user_id = $this->user['user_id']; $new_email = trim($this->input['new_email']); if (!$user_id) { $this->errorOutput(NO_LOGIN); } //查询出该人的信息 $user_info = $this->dingdone_mode->getUserByCond(" AND id = '" . $user_id . "'"); if (!$user_info) { $this->errorOutput(THIS_USER_NOT_EXISTS); } //邮箱不存在,报错 if (!$new_email) { $this->errorOutput(NO_EMAIL); } elseif ($new_email == $user_info['email']) { $this->errorOutput(THE_NEW_EMAIL_IS_SAME_TO_OLD); } elseif ($_isExistEmail = $this->dingdone_mode->getUserByCond(" AND email = '" . $new_email . "' AND id != '" . $user_id . "' ")) { $this->errorOutput(THIS_EMAIL_HAS_EXISTS); }