本文整理汇总了PHP中Cake\Network\Email\Email::configTransport方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::configTransport方法的具体用法?PHP Email::configTransport怎么用?PHP Email::configTransport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Network\Email\Email
的用法示例。
在下文中一共展示了Email::configTransport方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
public function email()
{
if ($this->request->is('get')) {
$userId = $this->Auth->user('id');
$username = $this->Auth->user('username');
$this->loadModel('UserTypes');
$userTypes = $this->UserTypes->listSubCategories();
$this->set(compact('userId', 'username', 'userTypes'));
} else {
if ($this->request->is('post')) {
Email::configTransport('gmail', ['host' => 'smtp.gmail.com', 'port' => 587, 'username' => 'ricardohenrique996@gmail.com', 'password' => 'mustang996', 'className' => 'Smtp', 'tls' => true]);
$email = new Email();
$email->transport('gmail');
$email->from(['ricardohenrique996@gmail.com' => 'Store Site'])->to('ricardohenrique1@outlook.com')->emailFormat('html')->subject(FormatContactForm::getSubject($this->request->data['subject'], ['suffix' => ' | Store Site']))->send(FormatContactForm::getMessage($this->request->data, ['uppercaseLabel' => true]));
return $this->redirect(['controller' => 'CustomStaticPages', 'action' => 'index']);
}
}
}
示例2: env
* If you define fullBaseUrl in your config file you can remove this.
*/
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();
示例3: 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());
}
示例4: 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'));
Email::configTransport('sparkpost', ['className' => 'SparkPost.SparkPost', 'apiKey' => Configure::read('SparkPost.Api.key')]);
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();
});
示例5: testDropTransport
/**
* Test dropping a transport configuration
*
* @return void
*/
public function testDropTransport()
{
$result = Email::configTransport('debug');
$this->assertInternalType('array', $result, 'Should have config data');
Email::dropTransport('debug');
$this->assertNull(Email::configTransport('debug'), 'Should not exist.');
}
示例6: array
Configure::write('debug', 1);
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
Configure::write('environment', 'local');
ConnectionManager::config('default', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'persistent' => false, 'host' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'test_be', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false]);
Email::configTransport('smtp', ['className' => 'Smtp', 'host' => 'ssl://smtp.gmail.com', 'port' => 465, 'timeout' => 30, 'username' => 'briefing@bliss-interactive.com', 'password' => 'bliss421briefing']);
Configure::write('ga_account', array('en' => 'UA-35390446-3', 'fr' => 'UA-35390446-3', 'nl' => 'UA-35390446-3'));
} else {
if (strpos($domain_name, "happiness-brussels.com") !== FALSE || strpos($domain_name, "bliss-interactive.net") !== FALSE) {
Configure::write('debug', 0);
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
Configure::write('environment', 'preview');
ConnectionManager::config('default', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'persistent' => false, 'host' => 'localhost', 'username' => 'pre_hb_user', 'password' => 'MHmRh9Qa3S2HHAYx', 'database' => 'database', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false]);
Email::configTransport('smtp', ['className' => 'Smtp', 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => NULL, 'password' => NULL]);
Configure::write('ga_account', array('en' => 'UA-35390446-3', 'fr' => 'UA-35390446-3', 'nl' => 'UA-35390446-3'));
} else {
//date_default_timezone_set("Europe/Brussels");
Configure::write('debug', 0);
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
Configure::write('environment', 'live');
ConnectionManager::config('default', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'persistent' => false, 'host' => 'localhost', 'username' => '', 'password' => '', 'database' => 'database', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false]);
Email::configTransport('smtp', ['className' => 'Smtp', 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => NULL, 'password' => NULL]);
Configure::write('ga_account', array('en' => 'UA-35390446-3', 'fr' => 'UA-35390446-3', 'nl' => 'UA-35390446-3'));
}
}
Configure::write('Session', array('defaults' => 'php', 'cookie' => 'TESTBE', 'timeout' => 60));
示例7: setUp
public function setUp()
{
parent::setUp();
Email::configTransport('test', ['className' => 'Debug']);
$this->Email = new Email(['transport' => 'test', 'to' => 'jane@doe.com', 'from' => 'john@doe.com', 'helpers' => ['Html', 'Gourmet/Email.Email'], 'layout' => 'Gourmet/Email.default', 'emailFormat' => 'both']);
}