本文整理汇总了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;
}
示例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']);
}
示例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();
});
示例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());
}
示例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: '));
}