Laravel 5: Sending Email

前端 未结 5 847
一生所求
一生所求 2020-12-17 22:27

I am trying to send an email in laravel application. Here is my .env file:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME         


        
相关标签:
5条回答
  • 2020-12-17 23:05

    Well, I got it. Infact the email was not authenticated because that email required a mobile phone authentication after login. changing to other email address that required just login credentials, it worked.

    .env
    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USERNAME=youremail@host.com
    MAIL_PASSWORD=yourpassword
    MAIL_ENCRYPTION=tls
    
    0 讨论(0)
  • 2020-12-17 23:05

    If the above comments do not work, try clearing the cache:

    php artisan cache:clear
    php artisan config:clear
    
    0 讨论(0)
  • 2020-12-17 23:13

    maybe port error , you can look this web laravel or lumen send email

    0 讨论(0)
  • 2020-12-17 23:26

    I made the following mistake: I did not actually include the

    'encryption' => env('MAIL_ENCRYPTION'),
    

    to the array return in mail.php. I did include my host, port, username and password in the mail.php but not the encryption method (the encryption method I only included in the .env file), so trying out these mentioned solutions did bring a change in the error messages outcome, created a bigger confusion, but none solved the problem. Hope this helps someone!

    0 讨论(0)
  • 2020-12-17 23:27

    GMail SMTP requires encryption. Try changing setting as following.

     MAIL_PORT=465
     MAIL_ENCRYPTION=ssl
    
    0 讨论(0)
提交回复
热议问题