Home  >  Q&A  >  body text

Unable to authenticate to SMTP server with username 'phptest01072003@gmail.com' using 3 possible authenticators

Unable to authenticate with username 'phptest01072003@gmail.com' on SMTP server using 3 possible authenticators. Authenticator login returned expected response code 235, but received code '535' with message '535-5.7.8 Username and password not accepted. Learn more at 535 5.7.8 https://support. google .com/mail/?p= BadCredentials mv24-20020a17090b199800b001d954837197sm10565041pjb.22-gsmtp". Authenticator PLAIN returned expected response code 235, but received code '535' with message '535-5.7.8 Username and password not accepted. For more information, visit 535 5.7.8 https://support. google .com/mail/?p= BadCredentials mv24-20020a17090b199800b001d954837197sm10565041pjb.22-gsmtp". Authenticator XOAUTH2 returned expected response code 250, but received code '535' with message '535-5.7.8 Username and password not accepted. For more information, visit 535 5.7.8 https://support. google .com/mail/?p= BadCredentials mv24-20020a17090b199800b001d954837197sm10565041pjb.22-gsmtp".

Email code:-

public function html_email() {
        $data = array('name'=>"HJ KING");
        Mail::send('layout.forgotpasswordmodel', $data, function($message) {
           $message->to(session('forgotemail'), 'HII, '.session('forgotfname'))->subject
              ('ForgotPassword');
              $message->from('xyz@gmail.com','HJ KING');
        });
      //   echo "HTML Email Sent. Check your inbox.";
      // return redirect('forgotpassword');
      return redirect()->back()->withErrors([
          'email' => 'MAIL SENT SUCCESSFULLY',
      ]);
     }

.Env file: -

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=phptest01072003@gmail.com
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"


P粉262926195P粉262926195318 days ago776

reply all(1)I'll reply

  • P粉237647645

    P粉2376476452023-11-10 11:21:54

    at last

    I connect my Laravel app to Gmail

    Get the password by getting the password from the application in Security

    Enable two-step verification on my second Gmail account

    reply
    0
  • Cancelreply