當前位置: 首頁>>代碼示例>>PHP>>正文


PHP email::sendCloudMail方法代碼示例

本文整理匯總了PHP中email::sendCloudMail方法的典型用法代碼示例。如果您正苦於以下問題:PHP email::sendCloudMail方法的具體用法?PHP email::sendCloudMail怎麽用?PHP email::sendCloudMail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在email的用法示例。


在下文中一共展示了email::sendCloudMail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SendlinkEmail

 /**
  * 發送鏈接到郵箱
  */
 public function SendlinkEmail()
 {
     $template_name = $this->input['template_name'];
     $this->getEmail();
     $link_url = $this->input['link_url'];
     $identifierUserSystem = new identifierUserSystem();
     $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
     //多用戶係統
     if ($email = trimall($this->input['email'])) {
         $nick_name = '用戶';
         $appicon = '';
         $appname = '找回密碼';
         if (hg_check_email_format($email)) {
             $condition = " AND platform_id='" . $email . "' AND mb.type='email' AND mb.identifier=" . $identifier . "";
             $leftjoin = " LEFT JOIN " . DB_PREFIX . "member_bind as mb ON m.member_id=mb.member_id ";
             $memberInfo = $this->Members->get_member_info($condition, $field = ' mb.* ', $leftjoin, '', false);
             $nick_name = $memberInfo['nick_name'];
         }
         $this->type = 'resetpassword';
         $this->verify_email();
         $this->_expire_time = $this->settings['email_token_limit']['time_limit'] ? TIMENOW + $this->settings['email_token_limit']['time_limit'] : TIMENOW + 1000;
         $condition = " AND email='" . $email . "' AND status=0";
         $email_token_info = $this->email_token->show($condition, ' ORDER BY id DESC ', 'limit 1');
         if (!$email_token_info) {
             $this->token = $this->makeToken(16);
         } else {
             $this->token = $email_token_info[0]['token'];
             //如果該驗證碼已經過期就重新生成驗證碼
             if ($email_token_info[0]['expire_time'] < TIMENOW) {
                 $this->token = $this->makeToken(16);
                 $this->email_token->update($email, array('status' => 1));
             } else {
                 //如果沒有過期,過期時間還是原來的
                 $this->_expire_time = $email_token_info[0]['expire_time'];
             }
         }
         $url = $link_url . '&email=' . $email . '&token=' . $this->token;
         //準備發送郵件
         $sub = $this->input['sub'];
         $preg = array();
         $replace = array();
         if (!empty($sub)) {
             foreach ($sub as $k => $v) {
                 array_push($preg, "{$k}");
                 array_push($replace, "{$v}");
             }
         }
         if ($replace) {
             foreach ($replace as $k => $v) {
                 if ($v == '{membername}') {
                     $replace[$k] = $nick_name;
                 }
                 if ($v == '{link_url}') {
                     $replace[$k] = $url;
                 }
             }
         }
         $htmlBody = file_get_contents(ROOT_DIR . 'email_template/' . $template_name . '.html');
         $content = str_replace($preg, $replace, $htmlBody);
         include ROOT_PATH . 'lib/class/email.class.php';
         $emailapi = new email();
         $param = array('email' => $email, 'content' => $content, 'template_name' => $template_name, 'from' => $this->input['from'], 'fromname' => $this->input['fromname']);
         $result = $emailapi->sendCloudMail($param);
         $data = array('email' => $this->email, 'type' => $this->type, 'status' => 0, 'token' => $this->token, 'create_time' => TIMENOW, 'expire_time' => TIMENOW + $this->settings['email_token_limit']['time_limit']);
         $res = $this->email_token->create($data);
         $this->addItem($data);
         $this->output();
     }
 }
開發者ID:h3len,項目名稱:Project,代碼行數:72,代碼來源:send_mail.php


注:本文中的email::sendCloudMail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。