Created
May 4, 2011 07:13
-
-
Save nissuk/954865 to your computer and use it in GitHub Desktop.
CakePHP: QdmailComponentをコントローラの$componentsで初期化できるようにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* QdmailComponentをコントローラの$componentsで初期化できるようにしたコンポーネントです(実験的)。 | |
* | |
* 使用例 (コントローラ内) | |
* var $components = array('XQdmail' => array( | |
'smtp' => true, | |
'smtpServer' => array( | |
'host' => 'ssl://smtp.gmail.com' , | |
'port' => '465', | |
'user' => '{{example}}@gmail.com', | |
'pass' => '{{パスワード}}', | |
'protocol' => 'SMTP_AUTH', | |
) | |
)); | |
* | |
* @license Public domain | |
*/ | |
App::import('Component', 'Qdmail'); | |
class XQdmailComponent extends QdmailComponent { | |
function initialize(&$controller, $settings) { | |
$this->set($settings); | |
} | |
/* | |
* Qdmailの設定を一括で行います。 | |
* | |
* 使用例 | |
* $this->XQdmail->set(array( | |
'from' => '{{example}}@gmail.com', | |
'to' => '[email protected]', | |
'subject' => 'お問い合わせ', | |
'text' => 'お問い合わせが届きました…(略)' | |
)); | |
$this->XQdmail->send(); | |
*/ | |
function set($settings) { | |
foreach ($settings as $key => $value) { | |
$this->{$key}($value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment