jle2389
jle2389

Reputation: 309

ErrorException in StreamBuffer.php line 95: in laravel 5

I transfer my application from Laravel 4 to Laravel 5, in sending email particularly in (reset Password).. I got this error

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL

Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

but in laravel 4, it works.

Upvotes: 30

Views: 6546

Answers (7)

Kiran Kanzar
Kiran Kanzar

Reputation: 329

That's an error with your SSL certificate. You are trying to use a SSL connection (encrypted, secure connection) without a proper certificate.

That's because you are connecting from localhost, which is not secure, and that is blocked by the connection. You could avoid that by changing your localhost connection to a SSL based one.

Also check and add below code in 'config/mail.php' this file.

'stream' => ['ssl'=> ['allow_self_signed'=>true, 'verify_peer'=>false, 'verify_peer_name'=>false] ],

Upvotes: 1

Vajiheh Habibi
Vajiheh Habibi

Reputation: 479

Add

$mail->SMTPOptions = array(
   'ssl' => array(
   'verify_peer' => false,
   'verify_peer_name' => false,
   'allow_self_signed' => true
 ));

before

mail->send()

and replace

require "mailer/class.phpmailer.php";

with

require "mailer/PHPMailerAutoload.php";

Upvotes: 1

Matu95
Matu95

Reputation: 17

Go to location \vendor\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php en la linea 259.Comment the following:

//$options = array();

and add. $options['ssl'] = array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);

:D!

Upvotes: 1

YATIN SAGAR
YATIN SAGAR

Reputation: 19

you can use google app password ,for me it worked after changing the gmail password with app password you can do that by visiting my account>sign in>

Upvotes: 1

Mohammad Mudassir
Mohammad Mudassir

Reputation: 151

I faced similar problem so I set

MAIL_ENCRYPTION= in .env file.

and it worked fine for me.

Upvotes: 4

tusharvikky
tusharvikky

Reputation: 21

If you are using basically Windows for development this is the common problem.

Changing your mail driver to "mail" from "smtp" will help.

Upvotes: 1

Raz Weizman
Raz Weizman

Reputation: 89

This error means that the SSL certificate verification is failing.
A quick fix would be to add to StreamBuffer.php these lines right after the condition:

if (!empty($this->_params['sourceIp']))

$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;

Upvotes: 1

Related Questions