我有功能:
public function contact()
{
$dane = $this->data;
echo debug($dane);
$Email = new CakeEmail();
$Email->from(array(''.$this->data['kontakt']['email'].'' => 'Strefagospodarcza.pl'))
->to('contact@mysite.pl')
->subject(''.$this->data['kontakt']['temat'].'')
->send(''.$this->data['kontakt']['tresc'].'');
}
在Controller中的beforeFunction
function beforeFilter(){
App::uses('CakeEmail', 'Network/Email');
$this->Auth->userModel = 'User';
$this->Auth->allow('register','login','step2','TakeId','znajdzUzytkownikow');
}
我有错误:
Error: An Internal Error Has Occurred.
这种类型的堆栈跟踪:
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)
哪里出错?我看不到它,因为我看起来都很好:)
答案 0 :(得分:0)
更改app \ Config \ core.php
//from
Configure::write('debug', 1);
//to
Configure::write('debug', 2);
然后获取完整的错误消息。 当出现问题时,尽量避免使用一行代码进行调试。
把
App::uses('CakeEmail', 'Network/Email');
内部联系功能,可能是问题所在。
Powodzenia;)
答案 1 :(得分:0)
你是否在像WAMP这样的本地服务器上这样做?如果是,那么你会得到这种错误。如果要在本地服务器上进行测试,则需要设置邮件服务器。