我想使用 codeigniter 发送邮件。我正在使用 codeigniter 作为邮件程序。我写了一个控制器并将其上传到网上。当我打电话给控制器时。这显示了错误。我正在写我的控制器
<?php
class Testmail extends CI_Controller {
public $data = array();
public function __construct()
{
parent::__construct();
$this->load->helper('url_helper');
$this->load->helper(array('form', 'url'));
$this->load->library('email');
$this->load->helper('url');
}
public function mailsend()
{
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('kunal.saxena.kunal@gmail.com', 'Your Name');
$this->email->to('kunal.saxena.kunal@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
}
}
但它不工作,我得到了这样的错误
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.
User-Agent: CodeIgniter
Date: Mon, 28 May 2012 10:51:18 +0000
From: "Your Name"
Return-Path:
To: kunal.saxena.kunal@gmail.com
Subject: =?iso-8859-1?Q?Email_Test?=
Reply-To: "kunal.saxena.kunal@gmail.com"
X-Sender: kunal.saxena.kunal@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4fc358a653ad4@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Testing the email class.
如何删除此错误..?