我正在尝试Emailing System(CakeEmail Class)
在我的 CakePHP 应用程序中使用。当一个新用户在我的网站上注册时,它会向他/她发送一封电子邮件,说“您已保存,现在点击此链接登录”。我添加了这个功能,但它没有发送任何邮件或告诉我代码有什么问题。这是代码:p
App::uses('AppController','Controller','CakeEmail','Network/Email');p
.
.
.
public function signUp(){
if($this->request->is('post')){
$this->User->create();
if($this->User->save($this->request->data)){
$Email=new CakeEmail('default');
$Email->from(array('admin_beauty_class@email.com'=>'My Site'))
->to($this->request->data['User']['username'])
->subject('Welcome to Beauty Class')
->send('My message');
$this->Session->setFlash(__('You have been saved and an email has just been sent to you, check your mail-box and follow the given link to login'));
$this->redirect();
}else{
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
}
$this->set('title_for_layout','Sign Up');
}