如何从PHP的mail()失败中获取额外的错误信息?
When mail() fails, there not much info about what went wrong. I understand that the best course of action is to check your sendmail logs, or whatever mailer has PHP used. But from a programming and pragmatic, point of view: on a Linux hosted environment, what can a PHP program do to get as much extra info to properly log the failure, probable cause etc and produce an usable, actionable error?
当mail()失败时,没有太多关于出错的信息。我知道最好的做法是检查您的sendmail日志,或PHP使用的任何邮件程序。但是从编程和实用的角度来看:在Linux托管环境中,PHP程序可以做些什么来获取尽可能多的额外信息来正确记录故障,可能的原因等并产生可用的,可操作的错误?
2 个解决方案
#1
The problem is that, on a Unix-like system, PHP just hands the entire thing to a command-line utility that really only gives PHP the ability to say 'yay' or 'nay'. To do what you want, you'd want to use something like PEAR's Net_SMTP, which can actually communicate intelligently with the mail server.
问题在于,在类Unix系统上,PHP只是将整个事情交给一个命令行实用程序,它实际上只能让PHP能够说'yay'或'nay'。为了做你想做的事,你想要使用像PEAR的Net_SMTP这样的东西,它实际上可以与邮件服务器智能地通信。
更多相关文章
- 为什么函数在ELF中的其他共享库的长度信息?
- Linux程序设计——文件操作(标准I/O库)
- Linux下CPU显示信息解释
- 在Linux中的脚本中安装应用程序
- 如何发送一个字节(或字节)来测试在我的应用程序中监听的套接字?
- 简单的程序发布流程
- 确定shell程序中的相对路径或绝对路径
- 如何确保我的Linux程序不会产生核心转储?
- linux利用CMakeLists编译cuda程序