I have function:
public function contact()
{
$dane = $this->data;
echo debug($dane);
$Email = new CakeEmail();
$Email->from(array(''.$this->data['kontakt']['email'].'' => 'Strefagospodarcza.pl'))
->to('[email protected]')
->subject(''.$this->data['kontakt']['temat'].'')
->send(''.$this->data['kontakt']['tresc'].'');
}
And beforeFunction in Controller
function beforeFilter(){
App::uses('CakeEmail', 'Network/Email');
$this->Auth->userModel = 'User';
$this->Auth->allow('register','login','step2','TakeId','znajdzUzytkownikow');
}
I have error:
Error: An Internal Error Has Occurred.
And this type of stack trace:
CORE\Cake\Network\Email\MailTransport.php line 47 → MailTransport->_mail(string, string, string, string, null)
CORE\Cake\Network\Email\CakeEmail.php line 1066 → MailTransport->send(CakeEmail)
APP\Controller\UsersController.php line 477 → CakeEmail->send(string)
[internal function] → UsersController->kontakt()
CORE\Cake\Controller\Controller.php line 486 → ReflectionMethod->invokeArgs(UsersController, array)
CORE\Cake\Routing\Dispatcher.php line 187 → Controller->invokeAction(CakeRequest)
CORE\Cake\Routing\Dispatcher.php line 162 → Dispatcher->_invoke(UsersController, CakeRequest, CakeResponse)
APP\webroot\index.php line 109 → Dispatcher->dispatch(CakeRequest, CakeResponse)
Where is mistake? I can not see it, for me all looks fine :)
change in app\Config\core.php
Then get full error message. Try to avoid one line code is harder to debug when something goes wrong.
put
inside contact function, that's might be the problem.
Powodzenia ;)