0

ERROR WHEN SENDING MAIL

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

.env setup

APP_ENV=production
APP_DEBUG=true
APP_KEY=base64:JZ8iPKOEV8Ozfw7dQk08kMnK2fcakf1cQxGBsrDH+Ok=
SESSION_SECURE_COOKIE=false
MAIL_DRIVER=smtp
MAIL_HOST=******.***.***.**
MAIL_PORT=25
MAIL_ENCRPYTION=ssl / tls / “” / not present at all
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_FROM_ADDRESS=***@***.***.**

These are all the combos I tried on MAIL_ENCRPYTION

MAIL_ENCRPYTION=ssl / tls / “” / not present at all

Applied cacert.pem in php.ini file

Works when applying this solution to mail.php (below) but need a secure

-          'stream' => [
-            'ssl' => [
-              'allow_self_signed' => true,
-              'verify_peer' => false,
-              'verify_peer_name' => false,
-            ],
-          ],
morne
  • 4,035
  • 9
  • 50
  • 96
  • where did you get this `cacert.pem`? did you make it yourself (assuming so given `allow_self_signed` is true)? – Bagus Tesa Oct 11 '22 at 11:14
  • From this answer: https://stackoverflow.com/a/63450019/2240163 – morne Oct 11 '22 at 12:01
  • may we know what is the mail service you used? there are many stuffs need to be checked such as (but not limited to): 1) supported ssl/tls version; 2) port number (make sure you hit the one that supports the secure channel); 3) their certificate is valid – Bagus Tesa Oct 11 '22 at 13:43

0 Answers0