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


PHP Email::deliver方法代碼示例

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


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

示例1: main

 public function main()
 {
     $this->loadModel('Comms');
     $comms = $this->Comms->find('all')->select(['Comms.id', 'Comms.dest', 'Comms.subject', 'Comms.body', 'Users.email'])->contain('Users')->where(['OR' => [['comms_status_id' => COMM_NEW], ['comms_status_id' => 0]]])->limit(10)->toArray();
     foreach ($comms as $comm) {
         //TODO: correct this unreliable and inflexible way to send emails
         Email::deliver(COMPANY_EMAIL, $comm->subject, $comm->body, ['from' => $comm->user->email, 'transport' => 'default', 'domain' => WEBSITE_DOMAIN]);
         $this->Comms->patchEntity($comm, ['comms_status_id' => COMM_COMPLETED]);
         $this->Comms->save($comm);
     }
 }
開發者ID:esaul314,項目名稱:norn-cms,代碼行數:11,代碼來源:EmailerShell.php

示例2: testDeliver

 /**
  * testDeliver method
  *
  * @return void
  */
 public function testDeliver()
 {
     $instance = Email::deliver('all@cakephp.org', 'About', 'Everything ok', array('from' => 'root@cakephp.org'), false);
     $this->assertInstanceOf('Cake\\Network\\Email\\Email', $instance);
     $this->assertSame($instance->to(), array('all@cakephp.org' => 'all@cakephp.org'));
     $this->assertSame($instance->subject(), 'About');
     $this->assertSame($instance->from(), array('root@cakephp.org' => 'root@cakephp.org'));
     $config = array('from' => 'cake@cakephp.org', 'to' => 'debug@cakephp.org', 'subject' => 'Update ok', 'template' => 'custom', 'layout' => 'custom_layout', 'viewVars' => array('value' => 123), 'cc' => array('cake@cakephp.org' => 'Myself'));
     $instance = Email::deliver(null, null, array('name' => 'CakePHP'), $config, false);
     $this->assertSame($instance->from(), array('cake@cakephp.org' => 'cake@cakephp.org'));
     $this->assertSame($instance->to(), array('debug@cakephp.org' => 'debug@cakephp.org'));
     $this->assertSame($instance->subject(), 'Update ok');
     $this->assertSame($instance->template(), array('template' => 'custom', 'layout' => 'custom_layout'));
     $this->assertSame($instance->viewVars(), array('value' => 123, 'name' => 'CakePHP'));
     $this->assertSame($instance->cc(), array('cake@cakephp.org' => 'Myself'));
     $configs = array('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:maitrepylos,項目名稱:nazeweb,代碼行數:25,代碼來源:EmailTest.php

示例3: resetPassword

 /**
  * Reset user's password
  *
  * @param App\Model\Entity\User $user User
  * @return void
  */
 protected function resetPassword($user)
 {
     // primitive way to generate temporary password
     $user->password = $password = substr(sha1(time() . rand() . Configure::read('Security.salt')), 0, 8);
     $this->Users->save($user);
     Email::deliver($user->email, "New notejam password", "Your new temporary password is {$password}.\n             We recommend you to change it after signing in.", ["from" => "noreply@notejamapp.com", "transport" => "default"]);
 }
開發者ID:martinmayer,項目名稱:notejam,代碼行數:13,代碼來源:UsersController.php


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