IMAP diagnostics
IMAP AUTHENTICATIONFAILED: what it actually means
How it looks in the log
a1 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)The server received your username and password and refused. Note that this is not always a wrong password — the same code covers IMAP being switched off and the login being in the wrong format.
Causes, most likely first
- An account password is used where an app password is required. Gmail, Yandex, iCloud, Mail.ru and Yahoo all work this way.
- IMAP is not enabled in mailbox settings. Gmail and Yandex have a separate toggle, and access stays closed without it.
- Wrong login format: iCloud accepts the local part only, standard Yandex mailboxes too, while cPanel and Gmail want the full address.
- Microsoft 365 has basic authentication disabled tenant-wide — OAuth 2.0 is the only way in.
- An organisation admin has blocked third-party app access (Google Workspace, Yandex 360).
How to fix it
- Create an app password in account security settings and paste it without spaces.
- Enable IMAP: Gmail → Settings → Forwarding and POP/IMAP; Yandex → Settings → Email clients.
- Check the login format against your provider guide — half of all cases are exactly this.
- For Microsoft 365 switch to OAuth 2.0; a tenant admin consents once.
- Test by hand: openssl s_client -connect imap.example.com:993 -crlf then a1 LOGIN user pass to see the raw server reply.
FAQ
Common questions
Why is a correct password rejected?
Providers return one code for three different situations: wrong password, IMAP disabled, and third-party access blocked. Check IMAP first — it is the most common cause.
How do I know an app password is needed?
If the password signs you into the web interface but fails over IMAP, you need a separate app password. Modern providers do not accept account passwords over IMAP.
Other errors
Find out how big your mailbox is. It costs nothing.
Connect two servers, look at the size and decide. Or take the client and keep everything on your side.
Code on GitHub · built on imapsync · no sign-up