0

I am trying to send mail in laravel5.5 using simple mail method, below is the code which i am trying to call in controller for mail function:-

Mail::send('emails.special_orders', ['key' => 'value'], function($message)
    {
        $message->to('infinity@gmail.com', 'John Smith')->subject('Welcome!');
    });

After this, i have also put the details in .env file i.e.:-

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=infinity@gmail.com
MAIL_PASSWORD=12345
MAIL_ENCRYPTION=tls

Even in config/mail.php file i have written:-

'from' => [
    'address' => env('MAIL_FROM_ADDRESS', 'infinity@gmail.com'),
    'name' => env('MAIL_FROM_NAME', 'Example'),
],

When I am trying to send mail, I am receiving an error, like:-

{
"message": "stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed",
"exception": "ErrorException",
"file": "C:\\xampp\\htdocs\\salon\\vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\StreamBuffer.php",
"line": 94,
"trace": [
    {
        "function": "handleError",
        "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
        "type": "->"
    },

What could be the reason?

TS.developer
  • 117
  • 2
  • 12

1 Answers1

-1

Try using

MAIL_PORT=465

Some systems still use port 465 for SSL.

p.wright
  • 131
  • 1
  • 9
  • Thanks! But it is not working. I have used PORT=465 in both .env and mail file. Still same error. – TS.developer Dec 13 '17 at 04:31
  • Does this help: https://stackoverflow.com/questions/30556773/how-to-fix-stream-socket-enable-crypto-ssl-operation-failed-with-code-1 – p.wright Dec 13 '17 at 08:38