当前位置: 首页>>代码示例>>PHP>>正文


PHP Mail::getInstance方法代码示例

本文整理汇总了PHP中Mail::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::getInstance方法的具体用法?PHP Mail::getInstance怎么用?PHP Mail::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mail的用法示例。


在下文中一共展示了Mail::getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: download

 public function download()
 {
     if (isset($this->params['hash'])) {
         $hash = str_replace(' ', '+', $this->params['hash']);
         $info = Forum::decodeAttHash($hash);
         $name = $info['bid'];
         $id = $info['id'];
         $pos = $info['ap'];
         $mode = $info['ftype'];
         $num = $info['num'];
     } else {
         if (isset($this->params['name']) && isset($this->params['id']) && isset($this->params['pos'])) {
             if ($this->ByrSession->Cookie->read("XWJOKE") == "" && Configure::read("article.att_check")) {
                 $this->error404(ECode::$SYS_NOFILE);
             }
             $name = $this->params['name'];
             $mode = '' == $this->params['mode'] ? Board::$THREAD : intval($this->params['mode']);
             $num = $id = intval($this->params['id']);
             $pos = intval($this->params['pos']);
             $type = $this->params['type'];
         } else {
             $this->error404(ECode::$SYS_NOFILE);
         }
     }
     $archive = null;
     App::import("vendor", "model/mail");
     try {
         if (in_array($name, get_class_vars("MailBox"))) {
             $this->requestLogin();
             $box = new MailBox(User::getInstance(), $name);
             $archive = Mail::getInstance($id, $box);
         } else {
             $board = Board::getInstance($name);
             $board->setMode($mode);
             if (!$board->isSortMode()) {
                 $id = $num;
             }
             if (!$board->hasReadPerm(User::getInstance())) {
                 $this->error404(ECode::$SYS_NOFILE);
             }
             $archive = Article::getInstance($id, $board);
             $file = $archive->getFileName();
             if ($board->isNormal()) {
                 $this->cache(true, @filemtime($file));
             }
         }
     } catch (Exception $e) {
         $this->error404(ECode::$SYS_NOFILE);
     }
     //check thumbnail
     if (!empty($type)) {
         $this->Thumbnail->archive($type, $archive, $pos);
     }
     $archive->getAttach($pos);
     $this->_stop();
 }
开发者ID:tilitala,项目名称:nForum,代码行数:56,代码来源:attachment_controller.php

示例2: sendConfirmation

 public function sendConfirmation($userAttr)
 {
     $mail = Mail::getInstance();
     $mail->setTo($userAttr['email']);
     $mail->setFrom();
     $mail->setSubject('Your account is created succussful');
     $view = new View(HOME . DS . 'views' . DS . 'confirm.tpl');
     $view->set('user', $userAttr);
     $view->set('url', APP_URL . '/activate.php?token=' . $userAttr['confirmation_code']);
     $mail->setTemplate($view->content());
     return $mail->send();
 }
开发者ID:henryngoo,项目名称:magictest,代码行数:12,代码来源:Mail.php

示例3: download

 public function download()
 {
     if (!isset($this->params['name']) || !isset($this->params['id']) || !isset($this->params['pos'])) {
         $this->error(ECode::$SYS_NOFILE);
     }
     $name = $this->params['name'];
     $mode = '' == $this->params['mode'] ? Board::$THREAD : intval($this->params['mode']);
     $id = $this->params['id'];
     $pos = $this->params['pos'];
     $type = $this->params['type'];
     $archive = null;
     App::import("vendor", "model/mail");
     try {
         if (in_array($name, get_class_vars("MailBox"))) {
             $this->requestLogin();
             $box = new MailBox(User::getInstance(), $name);
             $archive = Mail::getInstance($id, $box);
         } else {
             $board = Board::getInstance($name);
             $board->setMode($mode);
             if (!$board->hasReadPerm(User::getInstance())) {
                 $this->error(ECode::$SYS_NOFILE);
             }
             $archive = Article::getInstance($id, $board);
             $file = $archive->getFileName();
             if ($board->isNormal()) {
                 $this->cache(true, @filemtime($file));
             }
         }
     } catch (Exception $e) {
         $this->error(ECode::$SYS_NOFILE);
     }
     //check thumbnail
     if (!empty($type)) {
         $this->Thumbnail->archive($type, $archive, $pos);
     }
     $archive->getAttach($pos);
     $this->_stop();
 }
开发者ID:tilitala,项目名称:nForum,代码行数:39,代码来源:attachment_controller.php

示例4: ajax_delete

 public function ajax_delete()
 {
     if (!$this->RequestHandler->isPost()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     if (!isset($this->params['type'])) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     $type = $this->params['type'];
     try {
         $box = new MailBox(User::getInstance(), $type);
     } catch (MailBoxNullException $e) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     if (!isset($this->params['num'])) {
         if (isset($this->params['form']['all'])) {
             //delete all
             try {
                 $all = $box->getRecord(1, $box->getTotalNum());
                 foreach ($all as $mail) {
                     $mail->delete();
                 }
             } catch (Exception $e) {
                 continue;
             }
         } else {
             //delete normal
             foreach ($this->params['form'] as $k => $v) {
                 if (!preg_match("/m_/", $k)) {
                     continue;
                 }
                 $num = split("_", $k);
                 try {
                     $mail = Mail::getInstance($num[1], $box);
                     $mail->delete();
                 } catch (Exception $e) {
                     continue;
                 }
             }
         }
     } else {
         try {
             //delete single
             $num = $this->params['num'];
             $mail = Mail::getInstance($num, $box);
             if (!$mail->delete()) {
                 $this->error(ECode::$MAIL_DELETEERROR);
             }
         } catch (Exception $e) {
             $this->error(ECode::$MAIL_DELETEERROR);
         }
     }
     $ret['ajax_code'] = ECode::$MAIL_DELETEOK;
     $ret['default'] = "/mail/{$type}";
     $ret['list'][] = array("text" => $box->desc, "url" => "/mail/{$type}");
     $this->set('no_html_data', $ret);
 }
开发者ID:tilitala,项目名称:nForum,代码行数:57,代码来源:mail_controller.php

示例5: ajaxRegister

 /**
  * ajaxRegister
  * 
  * @param  array $postData
  * @return mix
  */
 public function ajaxRegister($postData)
 {
     $validator = new Validator();
     $user = User::getInstance();
     $validator->addValidation('first_name', 'req', 'Please fill in first name');
     $validator->addValidation('last_name', 'req', 'Please fill in last name');
     $validator->addValidation('email', 'req', 'Please fill in email');
     $validator->addValidation('email', 'email', 'The input for Email should be a valid email value');
     $validator->addValidation('password', 'req', 'Please fill in password');
     $validator->addValidation('password', 'eqelmnt=confirm_password');
     if ($user->findByEmail($postData['email'])) {
         return $this->_response('', 1, 'Email already taken in system');
     }
     if (!$validator->validate()) {
         $errorHash = $validator->GetErrors();
         foreach ($errorHash as $input => $error) {
             return $this->_response('', 1, $error);
             break;
         }
     } else {
         $postData['password'] = md5($postData['password']);
         $postData['confirmation_code'] = Util::generateConfirmCode();
         if ($uid = $user->save($postData)) {
             $mail = Mail::getInstance();
             $mail->sendConfirmation($user->find($uid));
             return $this->_response('', 0, 'Your account is created succussful, please check your inbox (or spam box) and confirm your email to continue');
         }
     }
     return $this->_response('', 1, 'Oops! try again');
 }
开发者ID:henryngoo,项目名称:magictest,代码行数:36,代码来源:AppController.php

示例6: delete

 public function delete()
 {
     if (!$this->RequestHandler->isPost()) {
         $this->error(ECode::$SYS_REQUESTERROR);
     }
     if (!isset($this->params['type'])) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     if (!isset($this->params['num'])) {
         $this->error(ECode::$MAIL_NOMAIL);
     }
     $type = $this->params['type'];
     $num = $this->params['num'];
     try {
         $box = new MailBox(User::getInstance(), $type);
         $mail = Mail::getInstance($num, $box);
         $wrapper = Wrapper::getInstance();
         $data = $wrapper->mail($mail);
         if (!$mail->delete()) {
             $this->error(ECode::$MAIL_DELETEERROR);
         }
     } catch (MailBoxNullException $e) {
         $this->error(ECode::$MAIL_NOBOX);
     } catch (MailNullException $e) {
         $this->error(ECode::$MAIL_NOMAIL);
     } catch (Exception $e) {
         $this->error(ECode::$MAIL_DELETEERROR);
     }
     $this->set('data', $data);
 }
开发者ID:rainsun,项目名称:nForum,代码行数:30,代码来源:mail_controller.php

示例7: md5

     $message = "Information required is not complete!";
 } else {
     $username = $_POST['username'];
     $password = md5($_POST['password']);
     $firstname = $_POST['firstname'];
     $lastname = $_POST['lastname'];
     $email = $_POST['email'];
     $phone_number = $_POST['phone'];
     $fields = array('username' => $username, 'password' => $password, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'phone_number' => $phone_number);
     try {
         $user = new User();
         $user->create($fields);
         $success = true;
         $message = 'Welcome to sign up with FineTable :)';
         // Send welcome email
         $mail = Mail::getInstance();
         $mailto = $_POST['email'];
         $subject = 'Welcome to FineTable!';
         $body = '
             <div class="mail-body" style="padding: 20px; border: 5px solid rgb(254, 127, 65); border-radius: 4px; margin: 0 auto; width: 90%;">
                 <p>Hello ' . $firstname . ',</p>
                 <p>Thank you for joining FineTable. We will do our best to help you find the best restaurant for you!.</p>
                 <p>Click <a href="http://sfsuswe.com/~f15g06" target="_blank">FineTable</a> to start look for restaurant!</p>
                 <p>Thank you!</p>
                 <p>FineTable team</p>
             </div>
             ';
         $mail->add_mailto($mailto);
         $mail->add_subject($subject);
         $mail->add_body($body);
         $mail->send();
开发者ID:HuiSF,项目名称:FineTable-Class-Project,代码行数:31,代码来源:sign-up-user.logic.php

示例8: delete

 public function delete()
 {
     if (!isset($this->params['type'])) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     if (!isset($this->params['num'])) {
         $this->error(ECode::$MAIL_NOMAIL);
     }
     $type = $this->params['type'];
     $num = $this->params['num'];
     try {
         $box = new MailBox(User::getInstance(), $type);
     } catch (MailBoxNullException $e) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     try {
         $mail = Mail::getInstance($num, $box);
         if (!$mail->delete()) {
             $this->error(ECode::$MAIL_DELETEERROR);
         }
     } catch (Exception $e) {
         $this->error(ECode::$MAIL_DELETEERROR);
     }
     $this->redirect($this->_mbase . "/mail/{$type}?m=" . ECode::$MAIL_DELETEOK);
 }
开发者ID:tilitala,项目名称:nForum,代码行数:25,代码来源:mail_controller.php


注:本文中的Mail::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。