Пример #1
0
 /**
  * 找回密码页面
  */
 public function findPwd()
 {
     if (IS_POST) {
         $userName = I('post.username', '', 'trim');
         $email = I('post.email', '', 'trim');
         $userModel = D('User');
         $where = array('username' => $userName, 'email' => $email);
         $userInfo = $userModel->where($where)->find();
         if (empty($userInfo)) {
             $this->error('该用户不存在');
         }
         $newPwd = $userModel->createPassword();
         $data = array('password' => md5(md5($userInfo['username']) . $newPwd));
         $result = $userModel->where(array('id' => $userInfo['id']))->save($data);
         if ($result === FALSE) {
             $this->error('密码重置失败:' . $userModel->getError());
         }
         //将新密码发送到邮箱中去
         $mail = new \Lib\Mail();
         $mailResult = $mail->sendMail('重置密码', '您的新密码为:' . $newPwd, $userInfo['email'], $userInfo['cname']);
         if ($mailResult) {
             $this->success('新密码已发送到您的邮箱中,请登陆邮箱查收', U('Backend/Index/index'));
             exit;
         }
         $this->error('密码已重置,邮件发送失败,请联系系统管理员', U('Backend/Index/index'));
     }
     layout(false);
     $this->display();
 }
Пример #2
0
 /**
  * 发送邮件
  */
 public function sendmail()
 {
     set_time_limit(0);
     $objModel = D('Cvmail');
     $map = array('cvmail.status' => array('eq', '00'), 'company.status' => array('eq', '01'), 'company.email' => array('neq', ''));
     $field = 'cvmail.id,cvmail.content,company.email,company.contact';
     $join = 'LEFT JOIN company on cvmail.companyid = company.id';
     $mailList = $objModel->field($field)->where($map)->join($join)->limit('0,10')->select();
     if (empty($mailList)) {
         $this->success('发送成功', U('Backend/Cvmail/sendmail'));
         exit;
     }
     $mail = new \Lib\Mail();
     $errNum = $succNum = 0;
     foreach ($mailList as $mail) {
         $mailResult = $mail->sendMail('订阅邮件', $mail['content'], $mail['email'], $mail['contact']);
         if (!$mailResult) {
             $errNum++;
             continue;
         }
         $data = array('status' => '01', 'id' => $mail['id']);
         $objModel->save($data);
         $succNum++;
     }
     $this->success('发送成功,其中成功' . $succNum . '封,失败' . $errNum . '封', U('Backend/Cvmail/sendmail'));
 }
Пример #3
0
 public function sendValidEmil($companyId)
 {
     $companyInfo = $this->where(array('id' => $companyId))->find();
     if (!$companyInfo) {
         return $this->returnResult(array('status' => false, 'errMsg' => '该用户不存在'), 'JSON');
     }
     if ($companyInfo['emailstatus'] == 1) {
         return $this->returnResult(array('status' => true, 'errMsg' => '邮箱已认证'), 'JSON');
     }
     $emailChkCode = generatePwd(6, 1);
     $data = array('emailchkcode' => $emailChkCode);
     $result = $this->where(array('id' => $companyId))->save($data);
     $chkEmailUrl = U('/Company/Index/chkemail', array('chkcode' => $emailChkCode, 'companyid' => $companyId));
     if ($result) {
         $mail = new \Lib\Mail();
         $mailResult = $mail->sendMail('重置密码', '点击链接激活您的邮箱:' . DOMAIN . $chkEmailUrl, $companyInfo['email'], '企业用户', C('FROM_EMALI_ADDR'), C('FROM_EMAIL_NAME'));
         if ($mailResult) {
             return $this->returnResult(array('status' => true, 'errMsg' => '认证邮件已发送', 'code' => $emailChkCode), 'JSON');
         } else {
             return $this->returnResult(array('status' => false, 'errMsg' => '邮件发送失败'), 'JSON');
         }
     } else {
         return $this->returnResult(array('status' => false, 'errMsg' => '认证失败,请稍后再试'), 'JSON');
     }
 }
Пример #4
0
 public function __construct()
 {
     $mail = new \Lib\Mail();
     $data = array('to' => '*****@*****.**', 'subject' => 'Stomp消息测试一', 'content' => file_get_contents('http://www.csdn.com/'), 'headers' => 'Content-type:text/plain;charset=utf-8;' . "\r\n" . 'Cc: 李健 <*****@*****.**>' . ";\r\n" . 'From: 米兰邮件中心 <*****@*****.**>', 'params' => '');
     $data = array($data);
     $data[] = array('to' => '*****@*****.**', 'subject' => 'Stomp消息测试二', 'content' => '测试内容<br /><ul><li><h1>测试</h1></li><li>第一行</li></ul>', 'headers' => 'Content-type:text/html;charset=utf-8;' . "\r\n" . 'Cc: 李健2 <*****@*****.**>', 'params' => '');
     $re = $mail->send($data);
     var_dump($re);
     header('Content-type:application/json;charset=utf-8');
 }
Пример #5
0
 public static function SendEmail($emailAll)
 {
     $action_lang = \Lib\common\Language::loadLangPack($emailAll['lang']);
     if (defined('THEME_ROOT_PATH')) {
         include THEME_ROOT_PATH . 'email/' . $emailAll['theme'];
     } else {
         include $emailAll['theme'];
     }
     if (!isset($emailLR)) {
         include $emailAll['theme'];
     }
     $email_from = isset($emailAll['email_from']) && !empty($emailAll['email_from']) ? $emailAll['email_from'] : '';
     $emailuser = isset($emailAll['emailuser']) && !empty($emailAll['emailuser']) ? $emailAll['emailuser'] : '';
     if (empty($email_from)) {
         $preFix = '';
         switch ($emailAll['lang']) {
             case 'fr-fr':
                 $preFix = 'france-';
                 break;
             case 'de-ge':
                 $preFix = 'germany-';
                 break;
             case 'es-sp':
                 $preFix = 'spanish-';
                 break;
             case 'it-it':
                 $preFix = 'italia-';
                 break;
             case 'ru-ru':
                 $preFix = 'russia-';
                 break;
             case 'pt-pt':
                 $preFix = 'portugal-';
                 break;
         }
         $email_from = $preFix . '*****@*****.**';
     }
     $data = array('username' => $email_from, 'from' => 'Milanoo.com<' . $email_from . '>', 'to' => $emailAll['email'], 'subject' => isset($action_lang[$emailAll['emailtitle']]) ? $action_lang[$emailAll['emailtitle']] : $emailAll['emailtitle'], 'content' => $emailLR, 'headers' => "Content-type:text/html;charset=utf-8;\r\n");
     $mail = new \Lib\Mail();
     $re = $mail->send($data);
 }
Пример #6
0
 /**
  * 发送订阅邮件
  * @param int $managerId        求职者id
  * @param int $companyId        企业id
  */
 public function sendSubscriptionMial($managerId, $companyId, $employeeId)
 {
     if (empty($companyId)) {
         //企业id为空,直接返回错误,不可继续发送
         return false;
     }
     $managerModel = D('Manager');
     $managerInfo = $managerModel->field('*')->where(array('id' => $managerId))->find();
     if (empty($managerInfo)) {
         return false;
     }
     $companyModel = D('Company');
     $companyWhere = array('id' => array('IN', $companyId), 'emailstatus' => 1, 'status' => '01');
     $companyList = $companyModel->field('id')->where($companyWhere)->select();
     $sendCompanyId = $companyInfoArr = array();
     for ($i = 0; $i < count($companyList); $i++) {
         $sendCompanyId[] = $companyList[$i]['id'];
         $companyInfoArr[$companyList[$i]['id']] = $companyList[$i];
     }
     if (empty($sendCompanyId)) {
         //没有需要发送的企业
         return true;
     }
     $cvmailModel = D('Cvmail');
     $mail = new \Lib\Mail();
     foreach ($sendCompanyId as $tmpcid) {
         $url = U('Company/Cvmanager/viewmanager', array('employeeid' => $employeeId, 'companyId' => $tmpcid, 'chkloginstr' => generateEncrypt($tmpcid)), true, true);
         $content = '这是求职者;点击进入<a href="' . $url . '">爱才网</a>查看。如果无法打开,请访问以下链接:' . $url;
         $data = array('companyid' => $tmpcid, 'managerid' => $managerId, 'content' => $content, 'status' => '00', 'createdate' => date('Y-m-d'), 'updatedate' => date('Y-m-d'));
         $result = $cvmailModel->add($data);
         if ($result) {
             //发送邮件
             $companyEmail = $companyInfoArr[$tmpcid]['email'];
             $companyName = $companyInfoArr[$tmpcid]['companyname'];
             $mail->sendMail('推荐求职者', $content, $companyEmail, $companyName);
         }
     }
 }