"SMTP Error: Could not authenticate" in PHPMailer "SMTP Error: Could not authenticate" in PHPMailer php php

"SMTP Error: Could not authenticate" in PHPMailer


I encountered this problem. To get it working, I had to go to myaccount.google.com -> "Sign-in & security" -> "Apps with account access", and turn "Allow less secure apps" to "ON" (near the bottom of the page).

Alternatively you can follow this direct link to these settings

enter image description here


this is GMail issue

read this Google Help (https://support.google.com/mail/answer/14257?p=client_login&rd=1)

  1. Open your web browser and sign in to Gmail at http://mail.google.com/mail. If you see a word verification request, type the letters in the distorted picture and finish signing in.
  2. Close your browser and try accessing your messages in your email client again.
  3. If you're still having problems, visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password. If necessary, enter the letters in the distorted picture.
  4. Click Continue.
  5. Restart your mail client and try accessing messages in your email client again.

SMTP Error: Could not authenticate

Gmail issue


Try this instead :

$Correo->Username = "foo@gmail.com";

I tested it and its working perfectly without no other change