PHP imap_open() => [AUTHENTICATIONFAILED] for imap.gmail.com
Asked Answered
B

1

5

It's already several days that we have started experience issues with imap_open function when try to connect to imap.gmail.com it returns:

Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

Here is the sample of the code that I try to run:

imap_open("{imap.gmail.com:993/imap/ssl}INBOX", username, password, NULL, 1);

Can this be an issue with the versions of PHP/Open SSL? If yes how can I solve it?

Beelzebub answered 2/7, 2015 at 13:53 Comment(1)
Did this code work originally? Are you sure the credentials are correct?Mcdougald
S
9

There are two possible reasons:

1-Credentials are incorrect.

2-Gmail do not authorize imap for unrecognized web apps, you should enable this fact here gmail enable less secure apps

Sarisarid answered 3/7, 2015 at 7:35 Comment(2)
Kassav' the login credentials are correct, also we have tried to do same action form another servers. For some of them it works well, for some of them it doesn't work.Beelzebub
Our emails are app emails, they are not ending with gmail.com and it's impossible to make the call without SSL. Google has deprecated non-SSL calls for app emails.Beelzebub

© 2022 - 2024 — McMap. All rights reserved.