Laravel Gmail not working, “Username and Password not accepted. Learn more…”

后端 未结 8 2569
刺人心
刺人心 2020-12-02 14:49

When I try to send an e-mail through my website running Laravel 4, I get this exception:

{\"error\":{\"type\":\"Swift_TransportException\",\"message\":\"Expe         


        
8条回答
  •  鱼传尺愫
    2020-12-02 15:23

    I had lot of issues finding answer for this. Then after doing lot of trial and error i have found an solution to this. Most of the solution above worked for other but it help me upto 50%.

    So, This is how it worked for me (100%):

    1. Activate 2 step Verification in google
    2. Now you will be able to create app. Open it.
    3. Create new app (other app) and give your app name.
    4. Now generate password.

    Next in laravel, Goto .env file and change

        MAIL_USERNAME= 'App Name you created'
        MAIL_PASSWORD= 'Generated Password for that app'
    

    This should be able to send emails from your gmail account. Please leave a comment if it doesn't works for you.

提交回复
热议问题