Exemplo n.º 1
0
 public function exec($params = null)
 {
     $result = messenger::sendEmail($params['email'], $params['tmpl'], $params['content']);
     if ($result['rsp'] == "succ") {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 public function testSend()
 {
     $content = array('vcode' => rand(1000, 9999));
     $email = "*****@*****.**";
     $m = messenger::sendEmail($email, 'account-member', $content);
     if ($m['rsp'] == "fail") {
         echo $m['err_msg'];
         exit;
     }
     echo "发送邮件成功";
     exit;
 }
Exemplo n.º 3
0
 private function __implement($data)
 {
     $tmpl = 'user-item';
     foreach ($data as $key => $value) {
         $sendData['vcode'] = $value['vcode'];
         $result = messenger::sendEmail($value['email'], $tmpl, $sendData);
         if ($result['rsp'] == "fail") {
             throw new \LogicException(app::get('sysitem')->_('邮件发送失败'));
         } else {
             $params['gnotify_id'] = $value['gnotify_id'];
             app::get('sysitem')->rpcCall('user.updatenotifyitem', $params);
         }
     }
     return true;
 }
Exemplo n.º 4
0
 public function send_email($type, $email, $content)
 {
     if (!($tmpl = $this->sendtypeToTmpl($type))) {
         return false;
     }
     $vcodeData = $this->checkVcode($email, $type);
     $vcode = $this->randomkeys(6);
     $vcodeData['account'] = $email;
     $vcodeData['vcode'] = $vcode;
     $vcodeData['count'] = 1;
     $vcodeData['createtime'] = date('Ymd');
     $vcodeData['lastmodify'] = time();
     $data['shopname'] = app::get('sysconf')->getConf('site.name');
     $data['vcode'] = $content . "&vcode=" . $vcode;
     $key = $this->getVcodeKey($email, $type);
     $result = messenger::sendEmail($email, $tmpl, $data);
     if ($result['rsp'] == "fail") {
         throw new \LogicException(app::get('system')->_('邮件发送失败,请检查邮箱格式是否正确!'));
     }
     if (defined('WITHOUT_CACHE') && !constant('WITHOUT_CACHE')) {
         cacheobject::set($key, $vcodeData, 3600 * 24);
     } else {
         base_kvstore::instance('vcode/account')->store($key, $vcodeData, 3600 * 24);
     }
     return true;
 }