Cakephp 无效电子邮件:";from@your_app_domain.com&引用;卡克菲普
无效电子邮件:“from@your_app_domain.com“用cakephp 我在controller中编写了以下代码:Cakephp 无效电子邮件:";from@your_app_domain.com&引用;卡克菲普,cakephp,cakephp-2.3,Cakephp,Cakephp 2.3,无效电子邮件:“from@your_app_domain.com“用cakephp 我在controller中编写了以下代码: public function remember_password() { if ($this->request->is('post')) { $user = $this->User->findByEmail($this->request->data['User']['email']); if
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');
}
}
获取上述错误。提前感谢域中的下划线无效,请将配置中的
应用程序。从电子邮件更改为其他内容。更改的配置(Configure::read('Application.from\u email'))
主要位于app/Config/core.php或任何其他配置文件中
配置将类似于:
$config['Application'] = array(
'from_email'=>'from@your_app_domain.com',
.......... ................
);
@Ankit通常是app/Config/
文件夹中的文件。