Cakephp no puede enviar correo electrónico
Frecuentes
Visto 1,433 veces
0
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.
}
}
2 Respuestas
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
Prueba esta
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
Aquí está la referencia usos
Respondido el 11 de junio de 12 a las 19:06
1
This is a very common error that developers do at first, Change your App::uses
and separate them:
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');
Because of the new way cake references the classes.
Respondido el 04 de Septiembre de 13 a las 15:09
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php email cakephp or haz tu propia pregunta.