SMTP 535 authentication failed: fixes for Gmail, Microsoft 365 and email services

Why the mail server refused the login, and the fix for Gmail, Microsoft 365 and other services.

Some links on this page are affiliate links. If you sign up through one, Rigcheck may earn a commission at no cost to you. It doesn't change what this guide recommends. How we handle this.

A 535 reply means the mail server accepted your app's connection but refused its login. The network, port and encryption got far enough to ask for a username and password; the credentials, or the way they were sent, were rejected.

The most common reason in 2026 isn't a typo. Gmail and Microsoft 365 have both stopped accepting an account's normal password for SMTP, so a printer, WordPress plugin or app that worked for years suddenly fails.

Fixing a sending setup? Check that your domain's SPF, DKIM and DMARC are right too, so the mail is accepted once it sends.

Read the full error

The text after 535 usually names the service and the reason:

You seeServiceJump to
535-5.7.8 Username and Password not acceptedGmail or Google WorkspaceGmail
535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabledMicrosoft 365Microsoft 365
535 5.7.139 … user is locked by your organization's security defaults policyMicrosoft 365Microsoft 365
535 5.7.139 … basic authentication is disabledMicrosoft 365Microsoft 365
535 5.7.3 Authentication unsuccessfulMicrosoft 365Microsoft 365
535 Authentication failed with no detailAn email service or your own serverOther services

Gmail and Google Workspace

Since March 14, 2025, Google no longer accepts an account's normal password for SMTP, IMAP or POP ("less secure apps" are off for every account). Apps have to sign in with OAuth or, where it's allowed, an app password.

Use an app password

  1. Turn on 2-Step Verification for the Google account. App passwords only work on accounts that have it.
  2. Go to myaccount.google.com/apppasswords, give the app a name, and create the password. Google shows a 16-digit code.
  3. In your app or printer, keep the full email address as the username and put the app password where the account password was.

The SMTP settings Google lists for apps and devices:

Server: smtp.gmail.com
Port: 587 (TLS/STARTTLS) or 465 (SSL)
Username: your full email address
Password: the app password

Google doesn't offer app passwords when 2-Step Verification uses only security keys, on accounts with Advanced Protection, or on some work and school accounts; for a Google Workspace account, ask your admin. Changing the account's password revokes its app passwords, so the app fails again until you make a new one. Sending through smtp.gmail.com is limited to 2,000 messages a day.

Microsoft 365

Microsoft 365's SMTP endpoint for apps and devices is smtp.office365.com on port 587 with STARTTLS, signing in as a licensed mailbox (SMTP AUTH). Each 535 variant has its own cause.

"SmtpClientAuthentication is disabled"

SMTP AUTH is switched off. Microsoft turns it off for organizations created after January 2020, and it can be off for one mailbox or the whole tenant. An admin can turn it on for just the mailbox the app uses: in the Microsoft 365 admin center, Users → Active users, select the mailbox, Mail → Manage email apps, and tick Authenticated SMTP. Or in Exchange Online PowerShell:

Set-CASMailbox -Identity app@yourdomain.com -SmtpClientAuthenticationDisabled $false

"locked by your organization's security defaults policy" or "basic authentication is disabled"

The app is signing in with a username and password (Basic authentication), and the tenant blocks it. Microsoft says SMTP AUTH with Basic authentication isn't compatible with security defaults, and Microsoft is retiring it: as of November 2026, Microsoft's timeline turns Basic authentication for SMTP AUTH off by default for existing tenants at the end of December 2026 (admins can still turn it back on for now), new tenants won't have it, and a final removal date is due to be announced in 2027. So even if a password still works today, plan to move.

"535 5.7.3 Authentication unsuccessful"

Usually a wrong password, or the sign-in blocked by multifactor authentication or a Conditional Access policy that blocks legacy sign-ins. Check the mailbox's sign-in logs in Microsoft Entra ID for the exact reason.

What to use instead of a password

  • OAuth 2.0, if your app supports it: the same SMTP server, but the app signs in with a token instead of a password.
  • Microsoft 365 SMTP relay through a connector, for printers and apps that send from a fixed IP address.
  • Microsoft's alternatives: High Volume Email (internal recipients only) or Azure Communication Services Email.
  • A transactional email service, which gives your app its own SMTP credentials or API key and doesn't depend on a staff mailbox: see transactional email providers compared.

For office printers and scanners that can't do any of these, compauth=fail reason=601 covers the device options (direct send and relay) and their pitfalls.

Email services and other servers

  • Use the service's SMTP credentials, not your account login. Email services generate a separate SMTP username and password or API key. With SendGrid, for example, the username is literally the word apikey and the password is an API key with mail-sending permission.
  • Check the key hasn't been deleted or limited. A rotated or revoked API key gives a 535 straight away.
  • Copy the password carefully into config files. A trailing space, or a character like # or $ that your .env file or shell treats specially, changes the password the app actually sends. Quote the value.
  • Match the username format. Most servers want the full email address; a few want just the part before @.

Sending again? Check that your domain's SPF, DKIM and DMARC pass, so the mail lands.

Check my setup

Browse all guides