无效的电子邮件:cakephp 中的“from@your_app_domain.com”
我在控制器中编写了这段代码:
public function remember_password()
{
if ($this->request->is('post')) {
$user = $this->User->findByEmail($this->request->data['User']['email']);
if (empty($user)) {
$this->Session->setFlash('This email does not exist in our database.', 'flash_fail');
$this->redirect(array('action' => 'login'));
}
$hash = $this->User->generateHashChangePassword();
$data = array(
'User' => array(
'id' => $user['User']['id'],
'hash_change_password' => $hash
)
);
$this->User->save($data);
$email = new CakeEmail();
$email->template('remember_password', 'default')
->config('gmail')
->emailFormat('html')
->subject(__('Remember password - ' . Configure::read('Application.name')))
->to($user['User']['email'])
->from(Configure::read('Application.from_email'))
->viewVars(array('hash' => $hash))
->send();
$this->Session->setFlash('Check your e-mail to continue the process of recovering password.', 'flash_success');
}
}
得到上述错误。提前致谢