$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('rudzstyle@yahoo.co.id', 'Your Name');
$this->email->to('rudzstyle@gmail.com');
$message = $data->nama_depan.'<br>'.$this->input->post('snk');
$this->email->subject($message);
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
调试器的结果是
Exit status code: 1 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, 2 Jun 2014 07:53:21 +0200 From:
“Your Name” Return-Path: To: rudzstyle@gmail.com Subject:
=?iso-8859-1?Q?Riyanto test?=
=?iso-8859-1?Q??= Reply-To: “rudzstyle@yahoo.co.id” X-Sender: rudzstyle@yahoo.co.id X-Mailer: CodeIgniter X-Priority: 3
(normal) Message-ID: <538c1151179cb@yahoo.co.id> Mime-Version: 1.0Content-Type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 8bitTesting the email class.
解决方法:
在Codeigniter中,试试这个
$this->load->library('email');
$config['protocol']='smtp';
$config['smtp_host']='your host';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='your mail id';
$config['smtp_pass']='your password';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('no-reply@your-site.com', 'Site name');
$this->email->to('to-address-mail-id');
$this->email->subject('Notification Mail');
$this->email->message('Your message');
$this->email->send();
在$config [‘smtp_user’]字段中,提供您的email_id,在$config [‘smtp_pass’]字段中,提供该邮件的密码.
这将起作用.尝试一下.
希望这能解决您的问题.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。