【问题标题】:Cakephp send email 500 Internal Server ErrorCakephp 发送电子邮件 500 内部服务器错误
【发布时间】:2017-04-10 07:11:56
【问题描述】:

我正在 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')函数发生错误...... 这里有什么问题..任何帮助表示赞赏...

【问题讨论】:

  • 无论何时收到错误,请务必提及确切错误消息(最好从日志中以正确可读的方式复制)。另外,请务必提及您的 确切 CakePHP 版本(lib/Cake/VERSION.txt 中的最后一行) - 谢谢!
  • 问题出在 smtp 用户名和密码上。我更新了它,现在电子邮件可以正常工作了。顺便说一下,我使用的是 cakephp 2.6

标签: php email cakephp


【解决方案1】:

问题在于 smtp 用户名和密码。我更新了它,现在电子邮件可以正常工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-10
    • 1970-01-01
    • 2017-07-18
    • 2015-06-11
    • 2015-05-04
    • 2017-03-12
    • 1970-01-01
    相关资源
    最近更新 更多