Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL operation failed with code 1 Codeigniter does not send email

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();
like image 742
V. Mark Avatar asked Nov 20 '22 18:11

V. Mark


1 Answers

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

like image 83
Sarvap Praharanayuthan Avatar answered Nov 30 '22 22:11

Sarvap Praharanayuthan