codeigniter localhost email not sending

…衆ロ難τιáo~ 提交于 2019-12-01 10:56:58

问题


I have some problem and I don't understand. This is my code

$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();

that 2 email are active email.

and the result of the debugger is this

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.0

Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Testing the email class.


回答1:


In Codeigniter, Try this

$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();

In $config['smtp_user'] field,give your email_id and in $config['smtp_pass'] field,provide your password for that mail.

This will work.Just try it. Hope this will solve your problem.




回答2:


You can find your solution from these two links How to configure XAMPP to send mail from localhost?

http://thephpcode.blogspot.com/2009/03/setting-up-local-mail-smtp-pop3-imap.html



来源:https://stackoverflow.com/questions/23988146/codeigniter-localhost-email-not-sending

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!