search

Home  >  Q&A  >  body text

The response code was expected to be 250, but instead 535 was received, and the message was "535-5.7.8 Username and password not accepted"

<p>I recently encountered a SwiftMail error while trying to send an email through gmail. </p> <pre class="brush:php;toolbar:false;">Expected response code 250, but received code "535" with message "535-5.7.8 Username and password not accepted." /pre> <p>I tried sending an email through my gmail and Google thought I was spam (probably because I requested too quickly) and they sent me an email saying my account was accessed, which I told them it was I operated it myself. I was able to send emails without issue, I just now have this problem. </p> <p>This is the content of my env file. </p> <pre class="brush:php;toolbar:false;">MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=talentscoutphil@gmail.com MAIL_PASSWORD=mypasswordhere MAIL_FROM=talentscoutphil@gmail.com MAIL_NAME=talentscout</pre> <p><br /></p>
P粉510127741P粉510127741510 days ago622

reply all(2)I'll reply

  • P粉450079266

    P粉4500792662023-08-22 14:38:56

    I had the same problem, changing my gmail password solved the problem, also don't forget to enable Insecure Applications on your gmail account

    reply
    0
  • P粉937382230

    P粉9373822302023-08-22 12:53:36

    I researched on the internet and some of the answers included enabling "Lower App Access" and "Unlocking gmail verification code" but unfortunately didn't work for me Worked until I found two-step verification.

    What I did was:

    1. To enable two-step verification on Google, click here

    2. To create an application password for system use, click here

    3. I selected Other (custom name) and clicked Generate

    4. Go into my laravel environment file and edit it

      MAIL_USERNAME=talentscoutphil@gmail.com

      MAIL_PASSWORD=Generated password

    5. Restarted my Apache server and it worked again.

    This is my solution. I created this solution to at least save others from wasting time looking for possible answers.

    reply
    0
  • Cancelreply