1
votes

I have two environment. One PC and one laptop. I developed the application on the PC and the send email function is working fine but on the laptop it throws an fsockopen() error.

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

My code:

$config = Array(
        'protocol'  => 'smtp',
        'smtp_host' => 'ssl://smtp.gmail.com',
        'smtp_port' => 465,
        'smtp_user' => '[email protected]',
        'smtp_pass' => 'password',
        'mailtype'  => 'html',
        'charset'   => 'utf-8'
    );

    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('[email protected]', 'email');
    $this->email->to($a);

    $this->email->subject($b);
    $this->email->message($c);

    $this->email->send();

I think the XAMPP version is the same and I have checked the php.ini file and the extension=php_openssl.dll is uncommented.

What Am I doing wrong?

1

1 Answers

1
votes

You need to set openssl.cafile in php.ini.

I just downloaded XAMPP and checked, it seems that it is at /xampp/perl/vendor/lib/Mozilla/CA/cacert.pem.

Your php.ini needs to contain a line such as openssl.cafile = C:\path\to\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem