【问题标题】:500 Internal Server Error in ZendZend 中的 500 内部服务器错误
【发布时间】:2012-09-23 18:47:32
【问题描述】:

我在使用 Zend 并在提交上传文件的页面时遇到此错误 [500 Internal Server Error]。 错误日志文件如下所示。电子邮件是否与内部服务器错误有关?

[23-Sep-2012 18:15:12] PHP Fatal error:  Uncaught exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set()' in C:\Tools\Zend\ZendServer\share\ZendFramework\library\Zend\Mail\Transport\Sendmail.php:137
Stack trace:
#0 C:\Tools\Zend\ZendServer\share\ZendFramework\library\Zend\Mail\Transport\Abstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()
#1 C:\Tools\Zend\ZendServer\share\ZendFramework\library\Zend\Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 C:\Projects\dcs_new\config_local.php(86): Zend_Mail->send()
#3 C:\Projects\dcs_new\functions.php(277): smail('level2@hartaleg...', 'DCS: Document c...', 'Title: Testing ...', 'From: TAN CHEN ...')
#4 C:\Projects\dcs_new\functions.php(284): email_users_obj('alert@hartalega...', Array, 'DCS: Document c...', 'Title: Testing ...', 'From: TAN CHEN ...')
 in C:\Tools\Zend\ZendServer\share\ZendFramework\library\Zend\Mail\Transport\Sendmail.php on line 137

【问题讨论】:

  • 您的服务器上是否设置了 sendmail、postfix 或 SMTP 邮件?
  • 您需要try/catch 发送邮件并使用 ie 对此类失败做出反应。重试
  • 如何验证它们?我可以从 phpinfo 验证吗?
  • 原来是因为 email 的值是空的。我们从电子邮件服务器日志中发现了这个错误。

标签: php zend-framework


【解决方案1】:

看起来您的页面/脚本尝试发送邮件并尝试连接到在localhost:25 上运行的 SMTP 服务器。

所以,本质上,这是一个配置问题。

要克服本地开发人员的困难,您可以将development 环境的默认传输设置为Zend_Mail_Transport_File

application/configs/application.ini:

[development : production]
resources.mail.transport.type = file
resources.mail.transport.path = APPLICATION_PATH "/../data/mail"

记得创建data/mail 目录并授予网络服务器写入权限。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-17
    • 2011-10-17
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多