5
votes

A PHP Error was encountered

Severity: Warning

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

Filename: libraries/Email.php

Line Number: 1978

Codeigniter does not send e-mail because of this error.

My e-mail code:

$config = Array(
        'protocol'  => 'smtp',
        'smtp_host' => 'smtp.gmail.com',
        'smtp_port' => 587,
        'smtp_crypto' => 'tls',
        'smtp_user' => '[email protected]',
        'smtp_pass' => 'asd',
        'mailtype'  => 'html',
        'charset'   => 'utf-8'
    );

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

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

    $this->email->subject($asd);
    $this->email->message($asd);

    $this->email->send();
1
Your port is set on TSL.. change it to 465 and remove the smtp_crypto lineIlanus
It gave me fwrite(): send of 6 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. error. If I use ssl://smtp.gmail.com then it gave me fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed errorV. Mark
Set your CACert file. See, for example, curl_setopt cacert.pem for paypal. Or better, set it to the one CA that's needed (rather than the collection in cacert.pem).jww
What CA do I need? Could you explain this please?V. Mark

1 Answers

0
votes

This might help someone in the future.

Even if every credential is right, some antivirus or firewall installed in the machine might prevent sending email thru SMTP. Temporarily disabling the antivirus or firewall to check is a good idea.

In my case, Avast antivirus caused this issue, and disabling this resolved my problem.

To disable Avast intercepting SMTP, unchecking Scan outbound emails (SMTP) checkbox will do the trick.

Disable Avast SMTP interception