Php – Codeigniter send email OpenSSL error

codeigniteremailPHPssl

I am having trouble sending email. I don't know what to do. I already un-commented the extension=php_openssl.dll in php.ini file, but I still receive this error.

Here is my code:

function send_email(){
        $config = array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => '465',
            'smpt_timeout' => '30',
            'smtp_user' => 'example@gmail.com',
            'smtp_pass' => $pass,
            'charset' => 'utf-8',
            'newline' => "\r\n"
        );


        $this->load->helper('string');
        $this->load->library('email',$config);

        $this->email->from('example@yahoo.com', 'Mr. Duterte');
        $this->email->to('example2@yahoo.com');

        $this->email->subject('DU30');
        $this->email->message('change is coming');
        //.base_url().'item/'.random_string

       if( $this->email->send()){
           echo "Success";
       }else{
           echo "Fail";

       }
    }

And I am getting three errors:

First:

"fsockopen(): SSL operation failed with code 1. OpenSSL Error
messages: error:14090086:SSL
routines:ssl3_get_server_certificate:certificate verify failed"

Second:

fsockopen(): Failed to enable crypto

Third:

fsockopen(): unable to connect to ssl://smtp.googlemail.com:465
(Unknown error)

Best Answer

I have figured out the problem. I just turned off my antivirus (Avast).