laravel Expected response code 250 but got code “530”

后端 未结 9 729
有刺的猬
有刺的猬 2020-12-06 17:19

Im trying to Mail in Laravel 5.1

my mail.php code is

 return [
     \'driver\' => env(\'MAIL_DRIVER\', \'smtp\'),
     \'host\' => env(\'MAIL_HOS         


        
相关标签:
9条回答
  • 2020-12-06 17:52

    you need to enable your 2 step verification from gmail account.

    https://myaccount.google.com/security

    then use the generated key from there to your ENV_PASSWORD instead your real password.

    0 讨论(0)
  • 2020-12-06 17:55

    I had the same problem. I changed,

    MAIL_ENCRYPTION=null to 
    MAIL_ENCRYPTION=tls 
    
    php artisan config:cache
    

    and it worked.

    0 讨论(0)
  • 2020-12-06 17:55

    After enabling logging to the mail from the less secured devices, make sure that .env file contains the following configurations:

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USERNAME=your_email@gmail.com
    MAIL_PASSWORD="your_passwrod_here"
    MAIL_ENCRYPTION=tls
    

    Make sure that your password is rounded by the double quotes "".

    Make sure that your mail.php file contains configurations like the following:

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'your_email@gmail.com'),
        'name' => env('MAIL_FROM_NAME', 'your_email'),
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    

    And don't forget to close the server and run php artisan config:clear to clear the configuration cache.

    This worked for me

    0 讨论(0)
  • 2020-12-06 17:57

    Change in .env file:

    MAIL_ENCRYPTION=tls
    

    Clear cache:

    php artisan config:cache
    

    For Gmail accounts you need also turn on "Less secure app access" on https://myaccount.google.com/security. However that option shouldn't be changed on main account.

    0 讨论(0)
  • 2020-12-06 17:58

    Use SSL and port 465 like this:

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=465
    MAIL_USERNAME=mail@gmail.com
    MAIL_PASSWORD=12345678
    MAIL_ENCRYPTION=ssl
    

    100% will work.

    0 讨论(0)
  • 2020-12-06 17:58

    You should restart the artisan after those changes. That was the issue for me.

    0 讨论(0)
提交回复
热议问题