IMAP
IMAP AUTHENTICATIONFAILED means credentials were rejected — a regular password no longer works. An App Password or OAuth2 is now required. Steps for Gmail.
Updated Jul 1, 2026
The short answer
"Can Not Authenticate To IMAP Server" means the IMAP server rejected your AUTHENTICATE/LOGIN credentials (RFC 5530 AUTHENTICATIONFAILED) — usually a wrong username/password, a regular password used where the provider now requires an App Password or OAuth2, or a missing TLS handshake. Fix it by using an App Password (with 2-Step Verification) or OAuth2/XOAUTH2 on imap.gmail.com:993, not your normal login.
This error means your IMAP client connected to the mail server but the server rejected the credentials during the LOGIN or AUTHENTICATE exchange. In the IMAP protocol this surfaces as a tagged NO response, and modern servers tag it with the [AUTHENTICATIONFAILED] response code defined in RFC 5530 — "Authentication failed for some reason on which the server is unwilling to elaborate. Typically, this includes 'unknown user' and 'bad password'." A raw session looks like:
a1 LOGIN user@example.com hunter2a1 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
The connection (TCP + TLS) succeeded, so this is a credential/auth-method problem, not a network problem. The common causes:
abcd efgh ijkl mnop.)XOAUTH2, an expired access token or a malformed SASL string yields the same NO [AUTHENTICATIONFAILED].imap.gmail.com:993 (implicit TLS) or a STARTTLS-on-143 setup.Note: The legacy "enable Less Secure Apps" advice is obsolete. Google removed that toggle for personal accounts in 2022, and Workspace's own equivalent access was phased out on a delayed, multi-stage timeline that concluded May 1, 2025. Do not look for a "less secure apps" switch — it no longer exists on either account type.
1. Verify the host, port, and TLS. For Gmail/Workspace use imap.gmail.com, port 993, SSL/TLS on. Confirm you can reach it:
openssl s_client -connect imap.gmail.com:993 -crlf# then: a1 LOGIN you@gmail.com your-app-password
2. For Gmail / Google Workspace — use an App Password or OAuth2:
XOAUTH2 per Google's IMAP XOAUTH2 protocol docs. Make sure the access token is fresh — refresh it before it expires.3. For Microsoft 365 / Outlook.com — use OAuth2. Basic Auth for IMAP is disabled in all Exchange Online tenants (see Microsoft's Basic Authentication deprecation notice); configure modern auth (OAuth2) as described in Microsoft's OAuth IMAP/POP/SMTP guide.
4. Re-issue credentials after a password change. Google revokes App Passwords when the account password changes — generate a new one. The same applies after enabling 2FA.
5. Distinguish auth failure from a server outage. If the server returns [UNAVAILABLE] instead of [AUTHENTICATIONFAILED] (RFC 5530), the backend auth subsystem is temporarily down — retry later rather than changing credentials.
References
FAQ
Because Google no longer accepts your normal account password over IMAP. Personal Gmail accounts lost Less Secure Apps access in a single clean cutover on May 30, 2022. Google Workspace accounts went through a separate, messier, multi-phase shutdown — announced in 2023, with the admin toggle removed around mid-2024, a planned cutover that slipped from September 2024 to March 2025, and a final hard deadline of May 1, 2025. Enable 2-Step Verification and generate a 16-character App Password, or use OAuth2/XOAUTH2, and use that instead of your login password.
One API, every provider
Courier connects to your email, SMS, and push providers, handles retries and failover, and surfaces delivery errors in plain language.
Reply-code definitions per RFC 5530 (AUTHENTICATIONFAILED); RFC 3501 §6.2.2 (AUTHENTICATE), §6.2.3 (LOGIN). Last reviewed Jul 1, 2026. Courier is not affiliated with third-party providers; error behavior may vary by implementation.
© 2026 Courier. All rights reserved.