CakePHP/CakeEmail-无法发送电子邮件

CakePHP/CakeEmail-无法发送电子邮件,email,cakephp,cakeemail,Email,Cakephp,Cakeemail,我有以下职能: 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')

我有以下职能:

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

}
控制器中的和before函数

    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)

错误在哪里?我看不到,对我来说一切都很好:)

在app\Config\core.php中更改

//from
Configure::write('debug', 1);
//to
Configure::write('debug', 2);
然后获取完整的错误消息。 当出现问题时,尽量避免单行代码更难调试

内部联系功能,这可能是问题所在


波沃泽尼亚;)

您是在像WAMP这样的本地服务器上这样做的吗?如果是,那么您将得到这种错误。如果要在本地服务器上测试邮件服务器,则需要设置邮件服务器。

可能重复
App::uses('CakeEmail', 'Network/Email');