2

The full error description is:

ErrorException stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

I am currently using Laravel 7 with Voyager setup (https://voyager.devdojo.com/).

I have this in my config already (based on some other answers) how to fix stream_socket_enable_crypto(): SSL operation failed with code 1

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

I did php artisan config:cache and php artisan config:clear

But I am still getting the same error.

This is what my .env looks like

MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_FROM_NAME="Voyager"
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=someUsername
MAIL_PASSWORD=somePassword
MAIL_ENCRYPTION=tls

2 Answers2

6

Ok I have resolved this error. I changed my .env

I simply changed my MAIL_DRIVER from smtp to sendmail and it is working perfectly fine.

MAIL_DRIVER=sendmail 
MAIL_HOST=smtp.gmail.com 
MAIL_PORT=587 
MAIL_USERNAME=mygmail@gmail.com 
MAIL_PASSWORD=****** 
MAIL_ENCRYPTION=tls

when I was working on my localhost then MAIL_DRIVER=smtp was working fine and when I uploaded my project on cpanel then I was getting this error.

Mohsin Raza
  • 488
  • 1
  • 6
  • 12
4

Not an expert on this subject, but you can try MAIL_ENCRYPTION=null.

I am fairly sure I had come across this in the past, and that was the culprit.

Kurt Friars
  • 3,625
  • 2
  • 16
  • 29
  • 4
    "Not an expert on this subject, but you can send email unencrypted across the internet so anyone can read it." – miken32 Sep 22 '21 at 17:20
  • @miken32 you do see he has `MAIL_HOST=smtp.mailtrap.io` set in env. I assume this is not for production use... – Kurt Friars Sep 22 '21 at 18:01