Codeigniter Email Class is not working on localhost
Errors
Message: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Message: fsockopen(): Failed to enable crypto
Message: fsockopen():unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)
public function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'fahadahmedkhan7223@gmail.com',
'smtp_pass' => '********',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('fahadahmedkhan7223@gmail.com');
$this->email->to('fahadahmedkhan7223@gmail.com');
$this->email->subject('Test');
$this->email->message("This is test of codeigniter email class.");
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
}