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


PHP Email::config方法代码示例

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


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

示例1: send

 /**
  * Send mail
  *
  * @param Email $email Email
  * @return array
  */
 public function send(Email $email)
 {
     if (!empty($this->_config['queue'])) {
         $this->_config = $this->_config['queue'] + $this->_config;
         $email->config((array) $this->_config['queue'] + ['queue' => []]);
         unset($this->_config['queue']);
     }
     $transport = $this->_config['transport'];
     $email->transport($transport);
     $QueuedTasks = TableRegistry::get('Queue.QueuedTasks');
     $result = $QueuedTasks->createJob('Email', ['transport' => $transport, 'settings' => $email]);
     $result['headers'] = '';
     $result['message'] = '';
     return $result;
 }
开发者ID:ameyrf,项目名称:cakephp-queue,代码行数:21,代码来源:QueueTransport.php

示例2: testSendWithEmail

 /**
  * TestSend method
  *
  * @return void
  */
 public function testSendWithEmail()
 {
     $Email = new Email();
     $Email->from('noreply@cakephp.org', 'CakePHP Test');
     $Email->to('cake@cakephp.org', 'CakePHP');
     $Email->cc(['mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso']);
     $Email->bcc('phpnut@cakephp.org');
     $Email->subject('Testing Message');
     $Email->transport('queue');
     $config = $Email->config('default');
     $this->QueueTransport->config($config);
     $result = $this->QueueTransport->send($Email);
     $this->assertEquals('Email', $result['jobtype']);
     $this->assertTrue(strlen($result['data']) < 10000);
     $output = unserialize($result['data']);
     //debug($output);
     //$this->assertEquals($Email, $output['settings']);
 }
开发者ID:repher,项目名称:cakephp-queue,代码行数:23,代码来源:QueueTransportTest.php

示例3: env

 */
if (!Configure::read('App.fullBaseUrl')) {
    $s = null;
    if (env('HTTPS')) {
        $s = 's';
    }
    $httpHost = env('HTTP_HOST');
    if (isset($httpHost)) {
        Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
    }
    unset($httpHost, $s);
}
Cache::config(Configure::consume('Cache'));
ConnectionManager::config(Configure::consume('Datasources'));
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));
Security::salt(Configure::consume('Security.salt'));
/**
 * The default crypto extension in 3.0 is OpenSSL.
 * If you are migrating from 2.x uncomment this code to
 * use a more compatible Mcrypt based implementation
 */
// Security::engine(new \Cake\Utility\Crypto\Mcrypt());
/**
 * Setup detectors for mobile and tablet.
 */
Request::addDetector('mobile', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isMobile();
});
开发者ID:sleeping-lion,项目名称:slboard_cakephp3,代码行数:31,代码来源:bootstrap.php

示例4: testMockTransport

 /**
  * CakeEmailTest::testMockTransport()
  */
 public function testMockTransport()
 {
     $mock = $this->getMock('\\Cake\\Network\\Email\\AbstractTransport');
     $config = array('from' => 'tester@example.org', 'transport' => 'default');
     Email::config('default', $config);
     Email::configTransport('default', $mock);
     $em = new Email('default');
     $this->assertSame($mock, $em->transport());
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:12,代码来源:EmailTest.php

示例5: testConstructWithConfigString

 /**
  * testConstructWithConfigString method
  *
  * @return void
  */
 public function testConstructWithConfigString()
 {
     $configs = array('from' => array('some@example.com' => 'My website'), 'to' => 'test@example.com', 'subject' => 'Test mail subject', 'transport' => 'debug');
     Email::config('test', $configs);
     $this->CakeEmail = new Email('test');
     $result = $this->CakeEmail->to();
     $this->assertEquals([$configs['to'] => $configs['to']], $result);
     $result = $this->CakeEmail->from();
     $this->assertEquals($configs['from'], $result);
     $result = $this->CakeEmail->subject();
     $this->assertEquals($configs['subject'], $result);
     $result = $this->CakeEmail->transport();
     $this->assertInstanceOf('Cake\\Network\\Email\\DebugTransport', $result);
     $result = $this->CakeEmail->send('This is the message');
     $this->assertTrue((bool) strpos($result['headers'], 'Message-ID: '));
     $this->assertTrue((bool) strpos($result['headers'], 'To: '));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:22,代码来源:EmailTest.php


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