CodeIgniter 无法使用 PHP mail() 发送电子邮件 [英] CodeIgniter unable to send email using PHP mail()

查看:38
本文介绍了CodeIgniter 无法使用 PHP mail() 发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Codeigniter 发送电子邮件,如下所示:

I'm trying to send an e-mail with Codeigniter like this:

$this->load->library('email');

$this->email->from("myemail@email.com");
$this->email->reply_to("myemail@email.com");
$this->email->to("myemail@email.com");
$this->email->subject("Test mail");
$this->email->message("Email body");
$this->email->set_alt_message("Email body txt");
$this->email->send();

我在电子邮件调试器上得到了这个:无法使用 PHP mail() 发送电子邮件.您的服务器可能未配置为使用此方法发送邮件.

and I got this on the email debugger: Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

如果我使用相同的地址执行简单的 PHP mail() 函数,它可以工作,但是当我使用 CodeIgniter 时,它会给我错误.那么为什么它适用于简单的 mail() 而不适用于 CodeIgniter 呢?有什么想法吗?

If I do e simple PHP mail() function with the same addresses, it works but when I use CodeIgniter it gives me the error. So why would it work with simple mail() but not with CodeIgniter ? Any ideas ?

谢谢.

推荐答案

您的 config 文件夹中有 email.php 文件吗?也许你的配置有问题.

Do you have an email.php file in your config folder? Maybe there's a problem with your configuration in there.

这篇关于CodeIgniter 无法使用 PHP mail() 发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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