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. This answer (localhost and "stream_socket_enable_crypto(): SSL operation failed with code 1") states that the error is "because you're connecting from localhost, which isn't secure, and that is blocked by the connection. You could avoid that by changing your localhost connection to a SSL based one." But how do I do that on production?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LWwXdm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire