我有一个安装在CentOS 6服务器上的sendmail似乎运行良好,因为我可以使用CLI发送测试消息 .
但是,当尝试使用CodeIgniter的电子邮件类发送测试邮件时,似乎存在一些问题 . 我的email.php配置是
$config['protocol'] = 'sendmail';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
用于测试电子邮件的控制器
$this->load->library('email');
$this->email->from('your@example.com', 'from name');
$this->email->to('someone@somewhere.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
当我通过CodeIgniter发送测试消息时,我收到此错误消息
Exit status code: 71
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.
在配置中切换到SMTP或邮件时,我仍然会收到错误 .
有什么建议从哪里开始尝试解决这个问题?
4 Answers
我没有看到您正在初始化邮件配置 . 尝试添加$ this-> email-> initialize($ config);
尝试这样的事情
试试这些 .
id apache
如果注释添加到组
chmod -v 2755 /usr/sbin/sendmail.sendmail
将config ['mailpath']更改为/use/sbin/sendmail.sendmail
如果这些tweeks不起作用,