Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technoknol/f4fa103034ef1b965b8e3ae52b54f38c to your computer and use it in GitHub Desktop.
Save technoknol/f4fa103034ef1b965b8e3ae52b54f38c to your computer and use it in GitHub Desktop.
Laravel - Disable SSL verification for SMTP
<?php
// File :: config/mail.php
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
@maciej-laskowski
Copy link

maciej-laskowski commented May 4, 2020

In case you are using Laravel 7.0 you can disable SSL verification in SwiftMailer this way (please note that disabling SSL verification is not recommended!):

config/mail.php

'mailers' => [
    'smtp' => [
        'transport' => 'smtp',
        'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
        'port' => env('MAIL_PORT', 587),
        'encryption' => env('MAIL_ENCRYPTION', 'tls'),
        'username' => env('MAIL_USERNAME'),
        'password' => env('MAIL_PASSWORD'),
        'timeout' => null,
        'stream' => [
            'ssl' => [
                'allow_self_signed' => true,
                'verify_peer' => false,
                'verify_peer_name' => false,
            ],
        ],
    ],
],

@jennyp786
Copy link

Hi maciej-laskowski , I was facing same issues but after doing this I am getting another error
#message: """
Failed to authenticate on SMTP server with username "support@helpknx.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data ◀
". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data
".
"""

@maciej-laskowski
Copy link

@jennyp786 The error message you are receiving now regards a different problem. I would suggest you start with double checking your smtp credentials using an email client for example. Also, if you provide your SMTP password in .env file make sure it is enclosed in quotes.

@jennyp786
Copy link

jennyp786 commented Nov 15, 2020

Thanks , I just reset the password and config cache clear , I got solution

@AtakanATC
Copy link

It's not working fine for me on Laravel 7.4

@maciej-laskowski
Copy link

@AtakanATC if you are looking for help provide more details. Which mailer are you using? what have you already tried? what is the exact error message that you are getting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment