Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

it9xpro's avatar

Error Sendmail using laravel (Xampp + php 7, windows)

i'm doing sendmail using laravel , but error i'm try

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=****** MAIL_ENCRYPTION=tls but eror

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

0 likes
10 replies
adamhut's avatar

I had the same problem.

First, make sure on php.ini has curl.cainfo , openssl.cafile and openssl.capath point to the right cacert.pem file,.

If you don't have it. you can download it from https://curl.haxx.se/ca/cacert.pem and place it anywhere you want

Just make sure you put the exactly path on ini file. This should solve your problem.

if don't , Disable your antivirus and test it again. This is how I got my problem resolve.

1 like
frcam's avatar

@adamhut whats the correct form to point the cacert.pam file?

I put openssl.capath="C:\xampp\sendmail\cacert.pem" and openssl.capath=C:\xampp\sendmail\cacert.pem\

but both returns me this error: failed loading cafile stream: `C:\xampp\sendmail\cacert.pem'

adamhut's avatar

@frcam openssl.capath="C:\xampp\sendmail\cacert.pem" looks good to me . I have similar setting. I place the .pem file under "C:\xampp\cacert.pem". Just make sure you have the pem file on the folder. It should be able to load it.

frcam's avatar

@adamhut unfortunately, dosen't works for me..

When I put port: 587 and tls, returns me the same 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 Help me fix.

And when I changed to port 465 and ssl returns me:

Connection could not be established with host smtp.gmail.com [ #0]

I have been loosing a lot of days with this! This error its driving me crazy!

Do you have another idea of what I can do? thanks!

adamhut's avatar

@frcam Did you shut down your antivirus when you run the test?

I had exactly the problem like you have. it took me a long time to figure it out. I will try my best to recall how I solve the issues.

  1. On php.ini file the configuration for openssl.cafile , openssl.capath and curl.cainfo point to the right location when .pem file locate

  2. disable the antivirus.

  3. this may help => change the ['verify_peer' => false, 'verify_peer_name' => false] on mailer setting

  4. Use send the mail using oAuth by using phpMailer through google API. for this I still do setting on point 3.

I hope this give you some help to solve the problem you have.

1 like
bajro17's avatar

I write about this I think in 5 posts you just need to go in config/mail.php and where write 'username' => env( 'yourusername'), 'password' => env('yourpassword'), change to this 'username' => 'yourusername', 'password' => 'yourpassword', just please write here if this help

frcam's avatar

@adamhut Thank you so much! I solved the problem disabling the antivirus, it was driving me crazy!

@bajro17 I have this configs, but only solved when disabling the antivirus!

2 likes
it9xpro's avatar

Thank every all . i am try turn off avast :D

2 likes
dharani's avatar

Thank you very much . i'm also turn off Avast now its working.

Please or to participate in this conversation.