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


PHP CakeEmail::template方法代码示例

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


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

示例1: contactus

 public function contactus()
 {
     if ($this->request->data) {
         $this->request->data['Contact'] = Sanitize::clean($this->request->data, array("remove_html" => TRUE));
         $cakeEmail = new CakeEmail('default');
         if ($this->request->data['Contact']['emailbool'] == "2") {
             $email_to = Configure::read('Config.general');
             $cakeEmail->template('enquiry', 'default')->emailFormat('html')->to($email_to)->subject('HaRiMau - General Enquiry');
         } else {
             $email_to = Configure::read('Config.business');
             $cakeEmail->template('enquiry', 'default')->emailFormat('html')->to($email_to)->subject('HaRiMau - Business Enquiry');
         }
         $cakeEmail->viewVars(array('user' => $this->request->data));
         if ($cakeEmail->send()) {
             $cnt_data = $this->Notification->find('count', array('conditions' => array('markas' => 'Unread', 'type' => 'Contact')));
             $arr['Notification']['type'] = 'Contact';
             $arr['Notification']['status'] = 'Approve';
             $arr['Notification']['count'] = $cnt_data + 1;
             $arr['Notification']['markas'] = 'Unread';
             $arr['Notification']['bell'] = 'On';
             $noti = $this->Notification->save($arr);
             $noti_data = $this->Notification->find('all', array('conditions' => array('markas' => 'Unread')));
             $numNoti = count($noti_data);
             $this->set('count', $numNoti);
             $this->Session->setFlash('<div class="alert alert-success"><i class="fa fa-check-circle"></i> An email with details is sent to system admin as earliest as will replied you. <button data-dismiss="alert" class="close" type="button">×</button> </div>');
             //$this->Session->setFlash(__('An email with details is sent to system admin as earliest as will replied you. '));
         } else {
             $this->Session->setFlash('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> Problem on sending email to enquiry department. Please contact to administrator.<button data-dismiss="alert" class="close" type="button">×</button> </div>');
             //$this->Session->setFlash(__('Problem on sending email to enquiry department. Please contact to administrator'));
         }
     } else {
         $this->set('count', 0);
     }
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:34,代码来源:HomeController.php

示例2: testPostmarkSend

 /**
  * testSendgridSend method
  *
  * @return void
  */
 public function testPostmarkSend()
 {
     $this->email->template('default', 'default');
     $this->email->emailFormat('both');
     $this->email->to(array('test1@example.com' => 'Recipient'));
     $this->email->subject('Test email via SedGrid');
     $this->email->addHeaders(array('X-Tag' => 'my tag'));
     $sendReturn = $this->email->send();
     //        $headers = $this->email->getHeaders(array('to'));
     //        $this->assertEqual($sendReturn['To'], $headers['To']);
     //        $this->assertEqual($sendReturn['ErrorCode'], 0);
     //        $this->assertEqual($sendReturn['Message'], 'OK');
 }
开发者ID:rogerbenevento,项目名称:sendgrid-webapi-cakephp-plugin,代码行数:18,代码来源:SendgridTransportTest.php

示例3: main

 public function main()
 {
     define('TIMEZONE', 'Asia/Bangkok');
     date_default_timezone_set(TIMEZONE);
     $now = date("Y-m-d H:i:s");
     $tomorrow = date("Y-m-d H:i:s", time() + EVENT_REMIDER_TIMER);
     $optionCalendar = array('order' => array('from_date' => 'asc'), 'conditions' => array('from_date >=' => $now, 'to_date <=' => $tomorrow));
     $events = $this->Calendar->find("all", $optionCalendar);
     foreach ($events as $key => $event) {
         $content = array();
         $content["id"] = $event["Calendar"]["id"];
         $content["name"] = $event["Calendar"]["name"];
         $content["description"] = $event["Calendar"]["description"];
         $content["from_date"] = $this->_formatDate($events[$key]["Calendar"]["from_date"], "d-m-Y H:i");
         $content["to_date"] = $this->_formatDate($events[$key]["Calendar"]["to_date"], "d-m-Y H:i");
         $id = $event["Calendar"]["id"];
         $user = $this->UserModel->findById($event["Calendar"]["user_id"]);
         $content["receive_name"] = $user["UserModel"]["display_name"];
         $Email = new CakeEmail('noreply');
         $noreplyConf = $Email->config();
         $Email->template('calendar_remider');
         $Email->emailFormat('html');
         $Email->viewVars(array('emailContent' => $content));
         $Email->from($noreplyConf['from']);
         $Email->to($user["UserModel"]["user_email"]);
         $Email->subject(__('Calendar Reminder'));
         $Email->send();
     }
     //echo EVENT_REMIDER_TIMER;
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:30,代码来源:CalendarMailShell.php

示例4: individualMail

 public function individualMail($section, $arr = array())
 {
     $this->autoRender = false;
     $contents = $this->Mail->findBySection($section);
     $content = $contents['Mail']['content'];
     foreach ($arr as $key => $val) {
         $content = str_replace("~~{$key}~~", $val, $content);
     }
     if (!empty($arr['TO_EMAIL']) && Validation::email($arr['TO_EMAIL'], true)) {
         $email = new CakeEmail();
         $email->template('default');
         $email->config('default');
         $email->emailFormat('html')->to($arr['TO_EMAIL'])->subject($contents['Mail']['subject']);
         try {
             if ($email->send($content)) {
                 return;
             } else {
                 return;
             }
         } catch (Exception $e) {
             return;
         }
     }
     return;
 }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:25,代码来源:MailController.php

示例5: send_mail

 /**
  * Send comfirmation email whit unique code
  */
 public function send_mail()
 {
     $user = $this->Session->read('Auth');
     if (isset($user)) {
         if ($user['User']['active'] == 0) {
             $uniqueId = uniqid("", TRUE);
             if ($this->saveSendComfirmation($user, $uniqueId)) {
                 App::uses('CakeEmail', 'Network/Email');
                 $email = new CakeEmail('gmail');
                 $link = "http://" . $_SERVER['HTTP_HOST'] . $this->webroot . "email/activate_account/" . $user['User']['id'] . '-' . $uniqueId;
                 $email->from('stagesstatcoordonateur@gmail.com');
                 $email->to($user['User']['email']);
                 $email->subject('Mail Confirmation');
                 $email->emailFormat('html');
                 $email->template('signup');
                 $email->viewVars(array('username' => $user['User']['full_name'], 'link' => $link));
                 $this->Session->setFlash(__('Email comfirmation has been sent'), 'flash/success');
                 $email->send();
             } else {
                 $this->Session->setFlash(__('Could not send email.'), 'flash/error');
             }
         } else {
             $this->Session->setFlash(__('Your email is already comfirmed.'), 'flash/error');
         }
     } else {
         $this->Session->setFlash(__('You are not login.'), 'flash/error');
     }
     $this->redirect('/');
 }
开发者ID:AndrewGMH,项目名称:StagesStatRepo,代码行数:32,代码来源:EmailController.php

示例6: main

 public function main()
 {
     // =============================================================================================
     // 各種情報を取得
     // =============================================================================================
     // 今年分の振込情報を取得
     $year = date('Y');
     $transfer_histories = $this->TTransferHistory->findTransferHistory($year);
     // 振込目標額を取得
     $total_price = $this->MParameter->find('first', array('conditions' => array('parameter_name' => 'total_price'), 'fields' => array('parameter_value')));
     $total_price = $total_price['MParameter']['parameter_value'];
     // 合計振込額を取得
     $total_transfer_price = $this->TTransferHistory->find('first', array('conditions' => array('deleted' => 1), 'fields' => array('sum(transfer_price) as total_transfer_price')));
     $total_transfer_price = $total_transfer_price[0]['total_transfer_price'];
     // 振込残高を取得
     $remaining_price = $total_price - $total_transfer_price;
     // =============================================================================================
     // メール送信処理
     // =============================================================================================
     $email = new CakeEmail('admin');
     $email->to('1970emerson.lake.and.palmer@gmail.com');
     $email->subject($year . '年の振込情報');
     $email->emailFormat('text');
     $email->template('transfer_report');
     $email->viewVars(array('total_price' => number_format($total_price), 'total_transfer_price' => number_format($total_transfer_price), 'remaining_price' => number_format($remaining_price), 'year' => $year, 'transfer_histories' => $transfer_histories));
     $email->send();
 }
开发者ID:Togatter,项目名称:money.home.jp,代码行数:27,代码来源:TransferReportShell.php

示例7: forgot

 /**
  * permet de refaire un mot de passe oublié
  * @return [type] [description]
  **/
 public function forgot()
 {
     $this->layout = "home";
     if (!empty($this->request->data)) {
         $user = $this->User->findByMail($this->request->data['User']['mail'], array('id'));
         if (empty($user)) {
             $this->Session->setFlash(__("This email address is not associated with any account"), 'notif', array('class' => "danger", 'type' => 'info'));
         } else {
             $token = md5(uniqid() . time());
             $this->User->id = $user['User']['id'];
             $this->User->saveField('token', $token);
             App::uses('CakeEmail', 'Network/Email');
             $cakeMail = new CakeEmail('smtp');
             // à changer par default sur le site en ligne ou smtp en local
             $cakeMail->to($this->request->data['User']['mail']);
             $cakeMail->from(array('philippewagner2@sfr.fr' => "site "));
             $cakeMail->subject(__('Password regeneration'));
             $cakeMail->template('forgot');
             $cakeMail->viewVars(array('token' => $token, 'id' => $user['User']['id']));
             $cakeMail->emailFormat('text');
             $cakeMail->send();
             $this->Session->setFlash(__("An email was sent to you with instructions to regenerate your password! Please check your span !!"), "notif", array('class' => 'info', 'type' => 'info'));
         }
     }
 }
开发者ID:atelfoto,项目名称:phicha.dev,代码行数:29,代码来源:UsersController.php

示例8: send

    public function send() {         
        ini_set('max_execution_time', 0);
        $test = array(
           array('User' => array('email' =>'manhquan@5stars.vn'))
        );
        $this->User->unbindAll();
        $users = $this->User->find('all', array('fields' => array('email'), 'conditions' => array('email not like "%@facebook.com%"'), 'order' => array('id DESC')));
        $count = 1;
        foreach ($users as $user) {
            if (!empty($user['User']['email'])) {
                $count++;
                try {                    
                    $email = new CakeEmail('stars');                       
                    $email->template('open')
                    ->emailFormat('html')
                    ->from(array('info@5stars.vn' => '5Stars MobileGames Ltd'))
                    ->to($user['User']['email'])
                    //->bcc(array('manhquan@5stars.vn'))
                    ->subject('Mỹ Hầu Vương | Tri ân người chơi tặng Gift code 500k nhân ngày Openbeta')
                    ->send();           

                    echo $count.' sent to '.$user['User']['email'].' waiting  10 sec...'. "\n";
                    
                    
                    sleep(1); 
                } catch(Exception $e) {
                    echo $e->getMessage();
                    echo $count.'cannot send to '.$user['User']['email']. "\n";
                }   
            }
        }  
    }
开发者ID:hungnt88,项目名称:5stars-1,代码行数:32,代码来源:SendEmailShell.php

示例9: sendResetMail

 /**
  * sendResetMail
  *
  */
 public static function sendResetMail($data, $user)
 {
     $modelName = $data['model'];
     $loader = ReminderConfigLoader::init($modelName);
     $email = new CakeEmail('reminder');
     $from = $email->from();
     if (empty($from)) {
         $email->from('reminder@example.com', 'Reminder');
     }
     $subject = $loader->load('subject');
     if (empty($subject)) {
         $subject = $email->subject();
     }
     if (empty($subject)) {
         $subject = 'Reminder';
         // default
     }
     $email->subject($subject);
     $email->to($data['email']);
     $template = $loader->load('view.reset_mail');
     if (empty($template)) {
         $template = 'reset_mail';
     }
     $email->template('Reminder.' . $template);
     $email->viewVars(array('data' => $data, 'user' => $user));
     return $email->send();
 }
开发者ID:k1low,项目名称:reminder,代码行数:31,代码来源:ReminderMail.php

示例10: process

 public function process()
 {
     $c = new CakeEmail('default');
     //grab 50 emails
     $emails = $this->EmailMessage->find("all", array("conditions" => array("EmailMessage.processed" => 0, "EmailMessage.to !=" => '', "NOT" => array("EmailMessage.to" => null)), "contain" => array()));
     $total_emails = count($emails);
     $this->out("emails to processes: " . $total_emails);
     SysMsg::add(array("category" => "Emailer", "from" => "MailerShell", "crontab" => 1, "title" => "Emails to processes: " . $total_emails));
     foreach ($emails as $email) {
         $e = $email['EmailMessage'];
         $c->reset();
         $c->config('default');
         $c->to($e['to']);
         $c->subject($e['subject']);
         $c->template($e['template']);
         $c->viewVars(array("msg" => $email));
         if ($c->send()) {
             $this->EmailMessage->create();
             $this->EmailMessage->id = $e['id'];
             $this->EmailMessage->save(array("processed" => 1, "sent_date" => DboSource::expression('NOW()')));
             $total_emails--;
             $this->out("Email:" . $e['to'] . " Template: " . $e['template']);
         } else {
             $this->out("Email failed: " . $e['id']);
             SysMsg::add(array("category" => "Emailer", "from" => "MailerShell", "crontab" => 1, "title" => "Email Failed: " . $e['id']));
         }
     }
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:28,代码来源:MailerShell.php

示例11: index

 /**
  * index method
  *
  * @return void
  */
 public function index()
 {
     $this->Comment->recursive = 0;
     if (!empty($this->request->data)) {
         $this->Comment->create($this->request->data);
         if ($this->Comment->validates()) {
             if (!empty($this->request->data['Comment']['website'])) {
                 $this->Session->setFlash(__("Your Mail us is reached."), 'notif', array('class' => "success", 'type' => 'ok-sign'));
                 $this->request->data = array();
             } else {
                 $token = md5(time() . ' - ' . uniqid());
                 $this->Comment->create(array('name' => $this->request->data['Comment']['name'], 'mail' => $this->request->data['Comment']['mail'], 'content' => $this->request->data['Comment']['content'], 'token' => $token));
                 $this->Comment->save();
                 App::uses('CakeEmail', 'Network/Email');
                 $CakeEmail = new CakeEmail('smtp');
                 // à changer par Default sur le site en ligne sinon smtp
                 $CakeEmail->to(array('philippewagner2@sfr.fr'));
                 $CakeEmail->from(array($this->request->data['Comment']["mail"] => "livre d or"));
                 $CakeEmail->subject(__("Commentaire sur le livre d'or"));
                 $CakeEmail->viewVars($this->request->data['Comment'] + array("name" => $this->Comment->name, "mail" => $this->Comment->mail, "content" => $this->Comment->content, 'token' => $token, 'id' => $this->Comment->id));
                 $CakeEmail->emailFormat('html');
                 $CakeEmail->template('commentaire');
                 $CakeEmail->send();
                 $this->Session->setFlash(__('The comment has been saved.'), 'notif', array('class' => "success", 'type' => 'ok-sign'));
                 return $this->redirect(array('action' => 'index'));
             }
         } else {
             $this->Session->setFlash(__('The comment could not be saved. Please, try again.'), 'notif', array('class' => "danger", 'type' => 'info-sign'));
         }
     }
     $this->paginate = array('Comment' => array('limit' => 3, 'order' => array('Comment.created' => 'desc')));
     $d['comments'] = $this->Paginate('Comment', array('Comment.online >= 1'));
     $this->set($d);
 }
开发者ID:atelfoto,项目名称:phicha.dev,代码行数:39,代码来源:CommentsController.php

示例12: add

 public function add()
 {
     //新規会員登録
     if ($this->request->is('post')) {
         $this->User->set($this->data);
         if ($this->User->validates()) {
             // status => 0, regist_code => xxxxxxxxxxxxxxx を $this->data に入れる
             $uuid = md5(uniqid());
             $data = $this->data;
             $data['User']['regist_code'] = $uuid;
             $this->User->save($data);
             $email = new CakeEmail('gmail');
             // インスタンス化
             $email->from(array('daiexile@yahoo.co.jp' => 'Sender'));
             // 送信元
             $email->to('yamapoon24@gmail.com');
             // 送信先
             $email->subject('twitter課題テスト');
             // メールタイトル
             $email->emailFormat('html');
             // フォーマット
             $email->template('mailsendtest');
             // テンプレートファイル
             $email->viewVars(array('registurl' => 'http://dev.elites.com/elites/twitter/users/registcomplete/', 'regist_code' => $uuid));
             $email->send('');
             // メール送信
             $this->redirect(array('contoller' => 'users', 'action' => 'sendmailcomplete'));
         }
     }
 }
开发者ID:dayama0328,项目名称:twitter,代码行数:30,代码来源:UsersController.php

示例13: __resetPassword

 protected function __resetPassword($username = '')
 {
     $this->loadModel('User');
     $conditions = array('username' => $username);
     $options = array('conditions' => $conditions);
     $user = $this->User->find('first', $options);
     $message = 'El usuario no existe.';
     if ($user) {
         $data['password'] = $this->strongPassword($username);
         $this->User->id = $user['User']['id'];
         $mensaje = 'No ha sido posible cambiar el password, intente de nuevo.';
         if ($this->User->save($data)) {
             $email = new CakeEmail('default');
             $email->template('change_password');
             $email->emailFormat('text');
             $email->from('mail@institucion.gob.sv');
             $email->to($username);
             $email->subject('Reinicio de credenciales gobscore.');
             $email->viewVars(array('username' => $username, 'password' => $data['password']));
             $message = 'El password ha sido cambiado con éxito. Ha ocurrido un ' . 'error en el envío de su nuevo password.';
             if ($email->send()) {
                 $message = 'Los datos de la institución y cuenta de ' . 'administrador han sido enviados correctamente';
             }
         }
     }
     return $message;
 }
开发者ID:el-quick,项目名称:gobierno-abierto,代码行数:27,代码来源:OperacionesController.php

示例14: mailer

 public function mailer()
 {
     $this->loadModel('User');
     // Check the action is being invoked by the cron dispatcher
     if (!defined('CRON_DISPATCHER')) {
         $this->redirect('/Mytime');
         exit;
     }
     //no view
     //$this->autoRender = false;
     $this->layout = 'ajax';
     $aUser = $this->User->find('all');
     foreach ($aUser as $user) {
         $currTime = time();
         $lastTime = strtotime(Hash::get($user, 'User.last_update'));
         $id = $user['User']['id'];
         $date1 = $lastTime > $currTime - 43200 ? date("Y-m-d H:i:s", $lastTime) : date("Y-m-d H:00:00", $currTime - 43200);
         $date2 = date("Y-m-d H:00:00", $currTime);
         $data = $this->User->getTimeline($id, $date1, $date2, 0, true);
         $this->set('data', $data);
         $this->set('timeFrom', strtotime($date1));
         $this->set('timeTo', strtotime($date2));
         if (count($data['events'])) {
             $Email = new CakeEmail('postmark');
             $Email->template('updates_mailer', 'mail')->viewVars(array('data' => $this->User->getTimeline($id, $date1, $date2, 0), 'timeFrom' => strtotime($date1), 'timeTo' => strtotime($date2)))->to(Hash::get($user, 'User.username'))->subject('Last updates on Konstruktor.com')->send();
         }
     }
     return;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:29,代码来源:CronController.php

示例15: RecoverPassword

 function RecoverPassword($username)
 {
     $response = array('status' => false, 'message' => 'Ocurrió un error');
     $this->Behaviors->attach('Containable');
     if ($user = $this->find('first', array('conditions' => array('UsuarioInterno.username' => $username), 'contain' => array('Empresa')))) {
         $this->id = $user['UsuarioInterno']['id'];
         $token = md5($user['UsuarioInterno']['id'] . $user['UsuarioInterno']['username'] . date('d-m-Y'));
         if ($this->saveField('token', $token)) {
             App::uses('CakeEmail', 'Network/Email');
             $url = Router::url(array('controller' => 'empresas', 'action' => 'cambiar_clave', $token), true);
             $Email = new CakeEmail();
             $Email->template('password');
             $Email->from(array('noreply@xperiencialaboral.com' => 'Xperiencia Laboral'));
             $Email->to($user['UsuarioInterno']['email']);
             $Email->subject('Recuperacion contraseña Xperiencia Laboral');
             $Email->viewVars(array('nombre' => $user['UsuarioInterno']['nombre'] . ' ' . $user['UsuarioInterno']['apellido'], 'url' => $url));
             $Email->emailFormat('html');
             if ($Email->send()) {
                 $response['message'] = 'Un link para reestablecer tu contraseña ha sido enviado a tu email ' . $user['UsuarioInterno']['email'];
                 $response['status'] = true;
             } else {
                 $response['message'] = 'Ocurrio un error al intentar enviar el mail';
             }
         }
     } else {
         $response['message'] = 'El email ingresado no corresponde a un usuario existente';
     }
     return $response;
 }
开发者ID:nskolaris,项目名称:employment-site,代码行数:29,代码来源:UsuarioInterno.php


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