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


PHP Email::deliver方法代碼示例

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


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

示例1: testDeliver

 /**
  * testDeliver method
  *
  * @return void
  */
 public function testDeliver()
 {
     $instance = Email::deliver('all@cakephp.org', 'About', 'Everything ok', ['from' => 'root@cakephp.org'], false);
     $this->assertInstanceOf('Cake\\Mailer\\Email', $instance);
     $this->assertSame($instance->to(), ['all@cakephp.org' => 'all@cakephp.org']);
     $this->assertSame($instance->subject(), 'About');
     $this->assertSame($instance->from(), ['root@cakephp.org' => 'root@cakephp.org']);
     $config = ['from' => 'cake@cakephp.org', 'to' => 'debug@cakephp.org', 'subject' => 'Update ok', 'template' => 'custom', 'layout' => 'custom_layout', 'viewVars' => ['value' => 123], 'cc' => ['cake@cakephp.org' => 'Myself']];
     $instance = Email::deliver(null, null, ['name' => 'CakePHP'], $config, false);
     $this->assertSame($instance->from(), ['cake@cakephp.org' => 'cake@cakephp.org']);
     $this->assertSame($instance->to(), ['debug@cakephp.org' => 'debug@cakephp.org']);
     $this->assertSame($instance->subject(), 'Update ok');
     $this->assertSame($instance->template(), ['template' => 'custom', 'layout' => 'custom_layout']);
     $this->assertEquals($instance->viewVars(), ['value' => 123, 'name' => 'CakePHP']);
     $this->assertSame($instance->cc(), ['cake@cakephp.org' => 'Myself']);
     $configs = ['from' => 'root@cakephp.org', 'message' => 'Message from configs', 'transport' => 'debug'];
     $instance = Email::deliver('all@cakephp.org', 'About', null, $configs, true);
     $message = $instance->message();
     $this->assertEquals($configs['message'], $message[0]);
 }
開發者ID:rashmi,項目名稱:newrepo,代碼行數:25,代碼來源:EmailTest.php

示例2: registro

 public function registro()
 {
     $usuario = $this->Usuarios->newEntity();
     //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' POST= '.var_export($_POST, true));
     //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' data= '.var_export( $this->request->data, true));
     if ($this->request->is('post')) {
         $usuario = $this->Usuarios->patchEntity($usuario, $this->request->data);
         //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' usuario= '.var_export( get_class( $usuario), true));
         //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' usuario= '.var_export( $usuario->__debugInfo(), true));
         if ($this->Usuarios->save($usuario)) {
             $url = 'http://' . $_SERVER['HTTP_HOST'] . '/recetas/cake/usuarios/activar-cuenta/' . $usuario['id'] . '/' . '0';
             //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' url= '.var_export( $url, true));
             Email::deliver($usuario['email'], 'Envío desde CakePHP', 'Pinche aquí para activar su cuenta:' . $url . '.', 'default', true);
             $this->Flash->success(__('El usuario ha sido creado correctamente. Revise su correo para validar la cuenta'));
             return $this->redirect($this->Auth->redirectUrl());
         } else {
             $this->Flash->error(__('No se ha podido crear el usuario. Inténtelo de nuevo.'));
         }
     }
     $this->set(compact('usuario'));
     $this->set('_serialize', ['usuario']);
 }
開發者ID:EPSZ-DAW2,項目名稱:daw2-2015-recetas-cocina,代碼行數:22,代碼來源:UsuariosController.php


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