CakeMail replaces the previous EmailComponent. So now we do this instead.
- Don’t set your view variables using set() anymore, use ->viewVars.
- Make sure you instantiate the class App::uses(‘CakeEmail’, ‘Network/Email’); in the top of your class.
- It also works from anywhere, and you can load helpers which is great.
- More info here. I really like it
$email = new CakeEmail();
$email->from(array(Configure::read('Site.email') => Configure::read('Site.title')))
->to((Configure::read('Config.debug')) ? Configure::read('Site.email') : $user['User']['email'])
->subject('[' . Configure::read('Site.title') . '] ' . __('Reset Password'))
->viewVars(array(
'user' => $user,
'activationKey' => $activationKey))
->template('forgot_password');