Cakephp发送电子邮件500内部服务器错误

时间:2017-04-10 07:11:56

标签: php email cakephp

我在cakephp中创建了一个用户。一切正常,但在创建用户后发送电子邮件时显示500内部服务器错误。当我打开调试模式时,它显示以下错误。

Stack Trace

CORE/Cake/Network/Email/SmtpTransport.php line 96 → SmtpTransport->_auth()
CORE/Cake/Network/Email/CakeEmail.php line 1161 → SmtpTransport->send(CakeEmail)
APP/Plugin/Client/Controller/EmployeesController.php line 176 → CakeEmail->send(string)
[internal function] → EmployeesController->add()
CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(EmployeesController, array)
CORE/Cake/Routing/Dispatcher.php line 193 → Controller->invokeAction(CakeRequest)
CORE/Cake/Routing/Dispatcher.php line 167 → Dispatcher->_invoke(EmployeesController, CakeRequest)
APP/webroot/index.php line 118 → Dispatcher->dispatch(CakeRequest, CakeResponse)

我发送电子邮件的代码,

if (!empty($useremail)) {
   $Email = new CakeEmail("smtp");
   $Email->helpers('Html', 'Form', 'Text');
   $Email->emailFormat('html')
    ->template('Client.newuseraddition', '')
    ->subject('FIELDTASKS: New User Added')
    ->to($useremail)
    ->from('no-reply@fieldtasks.com', 'FIELDTASKS')
    ->viewVars(compact('useremail', 'link'))
    ->send('My message');
}          

此行之后

$Email = new CakeEmail("smtp");       

我打印$Email变量并且打印成功。但send('My message')函数发生错误.... 这里有什么问题..感谢任何帮助...

1 个答案:

答案 0 :(得分:0)

问题在于smtp用户名和密码..我更新了它,现在电子邮件正在运行..