Codeigniter电子邮件错误处理 [英] Codeigniter Email error handling

查看:174
本文介绍了Codeigniter电子邮件错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CI电子邮件send()函数仅返回true或false。有没有办法得到更详细的原因,为什么发送失败?我使用SMTP。

The CI Email send() function only returns true or false. Is there a way to get a more detailed reason as to why a sending failed? I'm using SMTP.

推荐答案

您可以使用电子邮件调试程序进一步检查发生了什么:

You can further inspect what happened by using the email debugger:

$r = $this->send();
if (!$r)
  $this->email->print_debugger()
  ;

Codeigniter电子邮件类参考

如果需要将调试器输出作为字符串,可以使用输出缓冲区

If you need the debugger output as a string, you can just catch the output with an output buffer:

$errors = array();
... # Loop
$r = $this->send();
if (!$r) {
  ob_start();
  $this->email->print_debugger();
  $error = ob_end_clean();
  $errors[] = $error;
}
... # Loop end

这篇关于Codeigniter电子邮件错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆