使用"mail"或"sendmail"使用CodeIgniter发送电子邮件

pep*_*epe 3 php email smtp sendmail codeigniter

我构建了一个需要发送电子邮件(低容量)的Intranet应用程序.我将无法使用组织的SMTP服务器,因此我需要通过sendmail或发送这些电子邮件mail.

但是,当我将我的电子邮件配置为:

$config['protocol'] = 'sendmail';
Run Code Online (Sandbox Code Playgroud)

我明白了:

Exit status code: 127
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.
Run Code Online (Sandbox Code Playgroud)

当我使用时:

$config['protocol'] = 'mail';
Run Code Online (Sandbox Code Playgroud)

我明白了:

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Run Code Online (Sandbox Code Playgroud)

有什么我应该在PHP中设置或检查phpinfo()以弄清楚如何让它工作?

pep*_*epe 10

好的 - 这很简单.

对于任何面临此问题的人:

  1. 首先检查是否安装了sendmail(实际上是Postfix).我正在使用Ubuntu 11.x.

cd usr/sbin /

  1. 如果找不到sendmail,则需要安装
sudo apt-get install postfix
Run Code Online (Sandbox Code Playgroud)
  1. 我接受了对话框上的默认选项,一旦安装完成,发送的电子邮件没有问题.