public function sendByFindPassword($user_id) { //获取用户 $mod = new User_Model_User(); $user = $mod->get($user_id); if ($user == false) { throw new XF_Exception('用户不存在,无法发送邮件'); } if ($user->email == '') { throw new XF_Exception('用户邮件为空,无法发送邮件'); } //获取模板 $event = $this->get(4); //是否已关闭发送 if ($event->status == '0') { return; } $authCodeUrl = 'http://www.' . XF_Config::getInstance()->getDomain() . '/findPassword/?fromMailCode=' . urlencode(XF_Functions::authCode($user->user_id . ',' . $user->password . ',' . time())); $content = str_replace('{email}', $user->email, $event->mail_tpl); $content = str_replace('{authCodeUrl}', $authCodeUrl, $content); $this->sendEmail($user->email, $event->mail_title, $content); }