ユーザーコントローラーに次を追加しました:
App::uses('CakeEmail', 'Network/Email');
class UsersController extends AppController {
function sign_up() {
$this->autoRender = false;
$email = new CakeEmail('default');
$email->template('sign_up');
$email->emailFormat('html');
$email->subject('Addience.com Sign Up');
$email->to($this->request->query['email']);
$email->viewVars(array('password' => $this->Password->generatePassword(), 'email' => $this->request->query['email'], 'key' => $this->Password->generateKey()));
$email->send();
$this->redirect('/');
}
}
私の email.php 設定ファイルは次のようになります。
class EmailConfig {
public $default = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'xxx@gmail.com',
'password' => 'xxx',
'from' => array('support@xxx.com' => 'xxx'),
'transport' => 'Smtp'
);
}
しかし、私はまだ得ています:
Notice (8): Undefined index: email [APP\Controller\UsersController.php, line 311]
Notice (8): Undefined index: email [APP\Controller\UsersController.php, line 312]
You need specify one destination on to, cc or bcc.
Error: An Internal Error Has Occurred.
Stack Trace
#0 C:\xampp\htdocs\addience\Controller\UsersController.php(314): CakeEmail->send()
#1 [internal function]: UsersController->sign_up()
#2 C:\xampp\htdocs\cakephp-2.0.6\lib\Cake\Controller\Controller.php(473): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#3 C:\xampp\htdocs\cakephp-2.0.6\lib\Cake\Routing\Dispatcher.php(104): Controller->invokeAction(Object(CakeRequest))
#4 C:\xampp\htdocs\cakephp-2.0.6\lib\Cake\Routing\Dispatcher.php(86): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#5 C:\xampp\htdocs\addience\webroot\index.php(98): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#6 {main}
なんで?
ありがとうございました!