0

按下表单按钮后,我从 view.ctp 文件中调用了以下函数。然而什么都没有收到。有什么建议吗?

public function email(){
// ============Email================//

/* SMTP Options */
$this->Email->smtpOptions = array(
    'port' => '465',
    'timeout' => '30',
    'host' => 'ssl://smtp.gmail.com',
    'username' => 'email1@gmail.com',
    'password' => 'password1',
    'transport' => 'Smtp'
);

// sending/receiver details for email

$this->Email->template = 'resetpw';
$this->Email->from = 'Cafe <email1@gmail.com>';
$this->Email->to = 'Andrew <email2@gmail.com';
$this->Email->subject = 'Junto Cafe: Password reset';
$this->Email->sendAs = 'both';
$this->Email->delivery = 'smtp';
$this->set('ms', $ms);
$this->Email->send();
$this->set('smtp_errors', $this->Email->smtpError);

// after sending, display a notification

$this->Session->setFlash(__('Check Your Email To Reset your password', true) , 'alert-box', array(
    'class' => 'alert-success'
));

// ============EndEmail=============//
}
4

1 回答 1

0

解决了。忘记添加

App::uses('CakeEmail', '网络/电子邮件');

于 2015-01-11T15:14:08.767 回答