[英]Cakephp send email 500 Internal Server Error
我在cakephp中創建一個用戶。 創建用戶后發送電子郵件時一切正常,但顯示500 Internal Server Error。 當我打開調試模式時,它顯示以下錯誤。
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')
函數發生錯誤....這里是什么問題..感謝您的任何幫助...
問題出在smtp用戶名和密碼上。我更新了它,現在電子郵件正在工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.