SMTP error 535 means the server refused your login during SMTP authentication. Your app connected, offered a username and password (or a token), and the server said no. Nothing was sent. The enhanced code after 535 tells you which rule you hit.
535 5.7.8 Authentication credentials invalid
535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials
535 5.7.3 Authentication unsuccessful
535 5.7.139 Authentication unsuccessful, the organization configuration doesn't allow this authentication request.
What it means
RFC 4954, the SMTP AUTH standard, defines 535 5.7.8 as “Authentication credentials invalid”. The IANA registry adds that the client should ask the user for new credentials. Providers then add their own enhanced codes: Gmail uses 5.7.8, Microsoft 365 uses 5.7.3 and 5.7.139.
Why it happens
- Wrong username or password, including a typo, an old password, or the wrong environment variable.
- Gmail: normal account password. Google wants an app password (16 characters, 2-Step Verification required) or OAuth for SMTP. App passwords are revoked when the account password changes.
- Microsoft 365: SMTP AUTH turned off. The tenant-wide
SmtpClientAuthenticationDisabledsetting, a per-mailbox override, security defaults, or a policy disabling basic authentication. That gives 5.7.139. - Microsoft 365: bad credentials or OAuth setup. 5.7.3 appears for a wrong password and for OAuth tokens issued to the wrong app or user.
- Wrong username format. Many servers want the full email address; some relays use a fixed username and an API key as the password.
- No TLS before AUTH. Some servers only accept a login over an encrypted connection; that usually gives a 530 or 538 instead.
How to fix it
- Check the exact values your code sends. Print the username and the length of the password (never the password) from the running environment.
- Gmail or Google Workspace: turn on 2-Step Verification, create an app password and use it as the SMTP password with
smtp.gmail.comon 465 or 587. Better, use OAuth. See username and password not accepted. - Microsoft 365 with 5.7.139: an admin enables SMTP AUTH for the mailbox with
Set-CASMailbox -Identity user@example.com -SmtpClientAuthenticationDisabled $false, and checks that security defaults or authentication policies are not blocking it. Details in 535 5.7.3. - Microsoft 365 with 5.7.3: reset or re-enter the password, confirm the account has a licensed mailbox, and if you use OAuth, check the app registration and permissions.
- Use TLS. Connect on 465 (implicit TLS) or 587 with STARTTLS before you authenticate.
- For app email, use an email API or relay key instead of a person’s mailbox password. Keys can be rotated without locking anyone out.
Which server sent it
| Server | Reply | Meaning |
|---|---|---|
| Gmail | 535 5.7.8 Username and Password not accepted | Wrong password or not an app password |
| Microsoft 365 | 535 5.7.3 Authentication unsuccessful | Credentials or OAuth rejected |
| Microsoft 365 | 535 5.7.139 Authentication unsuccessful, the organization configuration doesn’t allow this authentication request | SMTP AUTH disabled by policy |
| Yahoo | 535 with its own text | Wrong password; Yahoo also uses app passwords for third-party mail apps |
| Generic (Postfix) | 535 5.7.8 Error: authentication failed: (reason) | Wrong credentials |
Google’s own error table currently prints this code as 5.7.80; the live server reply reads 5.7.8.
Is it temporary?
No. 535 is a 5xx permanent reply, so retrying the same login will fail every time, and repeated failures can trigger temporary lockouts such as Gmail’s 454 4.7.0 Too many sign-in attempts. Fix the credentials or setting first.
How Mailcandor handles it
Mailcandor’s SMTP relay at smtp.mailcandor.com uses the username mailcandor and an API key as the password, on port 465 or 587, so there is no mailbox password to expire. Once mail is flowing, the deliverability coach explains every bounce in plain English and hard bounces are suppressed automatically. Look up any code with the free bounce code lookup, browse the error library, check your domain with our SPF, DKIM and DMARC guide, or see the free tools.