0 votes
1 view
in AWS by (19.2k points)

stream_socket_enable_crypto(): SSL operation failed with code 1. 

OpenSSL Error messages: error:14090086:SSL 

routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Im using Laravel 4.2, PHP 5.6, Apache 2.4

I have GoDaddy SSL installed in Amazon ec2 Linux.

SSL working fine when i visit the site with https.

The error happened when I call my function :


public function sendEmail() 


        \Mail::send ( 'emails.code.code', $data, function ($sendemail) use($email) {

            $sendemail->from ( '[email protected]', 'Me Team' );

            $sendemail->to ( $email, '' )->subject ( 'Activate your account' );

        } );



I read some articles about this, they said that there are things we should make some changes, they put that code but i don't know where to insert it.

Been reading this: https://www.mimar.rs/en/sysadmin/2015/php-5-6-x-ssltls-peer-certificates-and-hostnames-verified-by-default/

and this documentation of php http://php.net/manual/en/migration56.openssl.php which is hard to understand.

1 Answer

0 votes
by (44.6k points)

There are two ways to solve this issue.

1. Change the protocol in app/config/email.php 

--> smtp to mail

2. Add the below code, where you disable SSL which is fine in a testing environment and not in a production environment. (Working in laravel 5.1,5.2,5.4,5.5,5.7,5.8)

'stream' => [

   'ssl' => [

      'allow_self_signed' => true,

      'verify_peer' => false,

      'verify_peer_name' => false,



Welcome to Intellipaat Community. Get your technical queries answered by top developers !