Php – codeigniter localhost email not sending

codeigniteremailgmailPHPyahoo

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.

Best Answer

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.

Related Topic