我有以下功能:
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'].'');
}和控制器中的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)错误在哪里?我看不到它,对我来说一切都很好:)
发布于 2014-03-27 18:57:47
app\Config\core.php中的更改
//from
Configure::write('debug', 1);
//to
Configure::write('debug', 2);然后获得完整的错误消息。当出现问题时,尽量避免一行代码更难调试。
放
App::uses('CakeEmail', 'Network/Email');在contact函数内部,这可能是问题所在。
Powodzenia ;)
发布于 2014-03-27 19:01:05
你是在像WAMP这样的本地服务器上做这个吗?如果是这样的话,你会得到这样的错误。如果你想在本地服务器上测试它,你需要设置你的邮件服务器。
https://stackoverflow.com/questions/22683986
复制相似问题