Cakephp无法发送电子邮件 [英] Cakephp unable to send email
本文介绍了Cakephp无法发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用cakePHP邮件系统,但我无法发送电子邮件,我收到以下错误:
I want to use the cakePHP mailer system, but I am unable to send an email, I get the following error:
Fatal error: Class 'CakeEmail' not found in D:... on line 100
在我的控制器中定义如下:
I have the following defined in my controller:
App::uses('AppController', 'Controller','CakeEmail', 'Network/Email');
// In the controller:
public function search() {
$email = new CakeEmail();
$email->from(array('noreply@assetchase.co.za' => 'Assetchase.co.za'));
$email->subject('result notification.');
foreach($emails as $value) {
$user = $this->User->find("first",array("fields" => array("username"),"conditions" => array("id" => $value)));
$email->to($user['User']['username']);
$email->send('A new notification, booyah!');
// Send an email with the username.
}
}
推荐答案
你必须修改 App :: uses ,因为App :: uses()只允许两个参数的类名和它的位置,你传递4个参数
Probably you have to modify App::uses because App::uses() only allows two arguments the class name and its location and you are passing 4 parameter instead
尝试此操作
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
这里是参考使用
这篇关于Cakephp无法发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文