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


PHP CakeEmail::theme方法代码示例

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


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

示例1: _sendEmail

 /**
  * Convenience method to send email
  *
  * @param string $from Sender email
  * @param string $to Receiver email
  * @param string $subject Subject
  * @param string $template Template to use
  * @param string $theme Theme to use
  * @param array  $viewVars Vars to use inside template
  * @param string $emailType user activation, reset password, used in log message when failing.
  * @return boolean True if email was sent, False otherwise.
  */
 protected function _sendEmail($from, $to, $subject, $template, $emailType, $theme = null, $viewVars = null)
 {
     if (is_null($theme)) {
         $theme = $this->theme;
     }
     $success = false;
     try {
         $email = new CakeEmail();
         $email->from($from[1], $from[0]);
         $email->to($to);
         $email->subject($subject);
         $email->template($template);
         $email->viewVars($viewVars);
         $email->theme($theme);
         $success = $email->send();
     } catch (SocketException $e) {
         $this->log(sprintf('Error sending %s notification : %s', $emailType, $e->getMessage()));
     }
     return $success;
 }
开发者ID:cvo-technologies,项目名称:webshop-customer-users,代码行数:32,代码来源:CustomerUsersController.php

示例2: _send_email

 /**
  * Send Email
  *
  * @param boolean $continue
  * @param array $contact
  * @return boolean
  * @access protected
  */
 protected function _send_email($continue, $contact)
 {
     $email = new CakeEmail();
     if (!$contact['Contact']['message_notify'] || $continue !== true) {
         return $continue;
     }
     $siteTitle = Configure::read('Site.title');
     try {
         $email->from($this->request->data['Message']['email'])->to($contact['Contact']['email'])->subject(__d('croogo', '[%s] %s', $siteTitle, $contact['Contact']['title']))->template('Contacts.contact')->viewVars(array('contact' => $contact, 'message' => $this->request->data));
         if ($this->theme) {
             $email->theme($this->theme);
         }
         if (!$email->send()) {
             $continue = false;
         }
     } catch (SocketException $e) {
         $this->log(sprintf('Error sending contact notification: %s', $e->getMessage()));
         $continue = false;
     }
     return $continue;
 }
开发者ID:saydulk,项目名称:croogo,代码行数:29,代码来源:ContactsController.php

示例3: _sendEmail

 /**
  * sendEmail
  *
  * @param array $node Node data
  * @param array $comment Comment data
  * @return void
  * @access protected
  */
 protected function _sendEmail($node, $data)
 {
     $email = new CakeEmail();
     $commentId = $this->Comment->id;
     try {
         $email->from(Configure::read('Site.title') . ' ' . '<croogo@' . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME'])) . '>')->to(Configure::read('Site.email'))->subject('[' . Configure::read('Site.title') . '] ' . __d('croogo', 'New comment posted under') . ' ' . $node['Node']['title'])->viewVars(compact('node', 'data', 'commentId'))->template('Comments.comment');
         if ($this->theme) {
             $email->theme($this->theme);
         }
         return $email->send();
     } catch (SocketException $e) {
         $this->log(sprintf('Error sending comment notification: %s', $e->getMessage()));
     }
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:22,代码来源:CommentsController.php

示例4: sendMail


//.........这里部分代码省略.........
     }
     // 件名
     $cakeEmail->subject($title);
     //From
     $fromName = $from = '';
     if (!empty($options['from'])) {
         $from = $options['from'];
     } else {
         if (!empty($this->siteConfigs['email'])) {
             $from = $this->siteConfigs['email'];
             if (strpos($from, ',') !== false) {
                 $from = explode(',', $from);
             }
         } else {
             $from = $toAddress;
         }
     }
     if (!empty($options['fromName'])) {
         $fromName = $options['fromName'];
     } else {
         if (!empty($this->siteConfigs['formal_name'])) {
             $fromName = $this->siteConfigs['formal_name'];
         } else {
             $formalName = Configure::read('BcApp.title');
         }
     }
     $cakeEmail->from($from, $fromName);
     //Reply-To
     if (!empty($options['replyTo'])) {
         $replyTo = $options['replyTo'];
     } else {
         $replyTo = $from;
     }
     $cakeEmail->replyTo($replyTo);
     //Return-Path
     if (!empty($options['returnPath'])) {
         $returnPath = $options['returnPath'];
     } else {
         $returnPath = $from;
     }
     $cakeEmail->returnPath($returnPath);
     //$sender
     if (!empty($options['sender'])) {
         $cakeEmail->sender($options['sender']);
     }
     //$theme
     if ($this->theme) {
         $cakeEmail->theme($this->theme);
     }
     if (!empty($options['theme'])) {
         $cakeEmail->theme($options['theme']);
     }
     //viewRender (利用するviewクラスを設定する)
     $cakeEmail->viewRender('BcApp');
     //template
     if (!empty($options['template'])) {
         $layoutPath = $subDir = $plugin = '';
         if ($options['agentTemplate'] && Configure::read('BcRequest.agent')) {
             $layoutPath = Configure::read('BcRequest.agentPrefix');
             $subDir = Configure::read('BcRequest.agentPrefix');
         }
         list($plugin, $template) = pluginSplit($options['template']);
         if ($subDir) {
             $template = "{$subDir}/{$template}";
         }
         if (!empty($plugin)) {
             $template = "{$plugin}.{$template}";
         }
         if (!empty($options['layout'])) {
             $cakeEmail->template($template, $options['layout']);
         } else {
             $cakeEmail->template($template);
         }
         $content = '';
         if (is_array($body)) {
             $cakeEmail->viewVars($body);
         } else {
             $cakeEmail->viewVars(array('body' => $body));
         }
     } else {
         $content = $body;
     }
     // $attachments tmp file path
     $attachments = array();
     if (!empty($options['attachments'])) {
         if (!is_array($options['attachments'])) {
             $attachments = array($options['attachments']);
         } else {
             $attachments = $options['attachments'];
         }
     }
     $cakeEmail->attachments($attachments);
     try {
         $cakeEmail->send($content);
         return true;
     } catch (Exception $e) {
         $this->log($e->getMessage());
         return false;
     }
 }
开发者ID:hanhunhun,项目名称:hanlog,代码行数:101,代码来源:BcAppController.php

示例5: forgot_password

 /**
  * admin_forgot_password method
  *
  * @return void
  */
 public function forgot_password()
 {
     if ($this->Session->read('Auth')) {
         $this->Session->setFlash(__('You are logged in!'), 'Flash/info');
         $this->redirect($this->referer());
     }
     if ($this->request->is('post')) {
         $this->User->recursive = -1;
         $conditions = array('User.email' => $this->request->data['User']['email']);
         $user = $this->User->find('first', compact('conditions'));
         if (!empty($user)) {
             $data = array('new_password_requested' => 'NOW()', 'new_password_hash' => 'MD5(' . time() . ')');
             $condition = array('User.id' => $user['User']['id']);
             $this->User->updateAll($data, $condition);
             //$this->User->recursive = -1;
             //$conditions = array('User.email'=>$this->request->data['User']['email']);
             $user = $this->User->find('first', compact('conditions'));
             $email = new CakeEmail('smtp');
             $email->to($user['User']['email']);
             $email->subject(__('Reset password from Locbit'));
             $email->template('Users/forgot_password', 'default');
             $email->helpers('Time', 'Html');
             $email->theme($this->theme);
             $email->viewVars(compact('user'));
             $email->send();
             $this->Session->setFlash(__('The recovery password email has been sent!'), 'Flash/success');
         } else {
             $this->Session->setFlash(__('The email you provided is not registered'), 'Flash/error');
         }
     }
 }
开发者ID:netors,项目名称:CakePhpAuthBootstrapPlugin,代码行数:36,代码来源:UsersController.php


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