2014-03-27 92 views
0

我有功能:的CakePHP/CakeEmail - 無法發送EMAIL

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'].''); 

} 

而且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

可能的重複http://stackoverflow.com/a/22661506/1239506 –

回答

0

變化\ CONFIG \ core.php中

//from 
Configure::write('debug', 1); 
//to 
Configure::write('debug', 2); 

然後得到完整的錯誤消息。 儘量避免一行代碼在出現問題時難以調試。

App::uses('CakeEmail', 'Network/Email'); 

接觸功能裏面,這是可能是問題。

Powodzenia;)

0

你本地服務器一樣WAMP上這樣做呢?如果是,那麼你會得到這種錯誤。如果你想在本地服務器上測試它,你需要設置你的郵件服務器。

相關問題