There are lots of people having similar issues but no one is answering their questions. I have IMAP enabled in PHP, Using all the correct information. I don\'t see where I\'
I had the same issue and I fixed it by unlocking the Google captcha.
Go to the following URL while signed in to the Google account : https://accounts.google.com/DisplayUnlockCaptcha
And click on the button.
Of course, you already had activated the access for less secure apps in the Security tab of your Google account settings ;).
It should work now !