当前位置: 首页>>代码示例>>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;未经允许,请勿转载。