samedi 28 juillet 2018

production.ERROR: stream_socket_enable_crypto(): SSL: Success (Laravel 5.5)

I'm getting this error when trying to send mail from my production server with a Laravel 5.5 project:

[2018-07-28 16:05:57] production.ERROR: stream_socket_enable_crypto(): SSL: Success {"exception":"[object] (ErrorException(code: 0): stream_socket_enable_crypto(): SSL: Success at /home/html/my-project/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:94)

Meanwhile I'm able to send mail via the same service in my local environment without any errors. I'm also able to send mail from a Laravel 5.4 project on the same server with a similar setup. I checked my .env file and how it's being read by config/mail.php, and everything appears to be correct.

MAIL_DRIVER="smtp"
MAIL_HOST="smtp.sparkpostmail.com"
MAIL_PORT=587
MAIL_ENCRYPTION="TLS"
MAIL_AUTHENTICATION="AUTH LOGIN"
MAIL_PASSWORD="mypassword"
MAIL_USERNAME="SMTP_Injection"

The accepted answer here (how to fix stream_socket_enable_crypto(): SSL operation failed with code 1) tells me to add the following to config/mail.php:

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

I tried this but got the same error. I also read that this is not a secure solution for production. So I'm baffled on how to fix this issue with Laravel 5.5.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire