Errors

535 5.7.8: authentication credentials invalid

Short answer

535 5.7.8 is the standard SMTP reply for a failed login. RFC 4954 defines it as Authentication credentials invalid. Gmail sends 535-5.7.8 Username and Password not accepted with a BadCredentials link; Postfix sends 535 5.7.8 Error: authentication failed. The cause is a wrong username or password, or the wrong kind of password, such as a Google account password instead of an app password. Fix the credentials; retrying will not help.

Last checked 16 November 2026

535 5.7.8 means the SMTP server checked your username and password and rejected them. The connection and encryption worked; only the login failed. Fix the credentials and it will work.

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.8 Error: authentication failed: (reason)

The first line is the RFC wording, the next two are Gmail’s, the last is Postfix’s, where the reason after the colon comes from the SASL library and varies.

What it means

RFC 4954 section 6 defines 535 5.7.8 Authentication credentials invalid: “This response to the AUTH command indicates that the authentication failed due to invalid or insufficient authentication credentials. In this case, the client SHOULD ask the user to supply new credentials.” It is the generic login failure, so you will see it from many servers.

Why it happens

  • Wrong password, often an old one still in an environment variable, a config file or a device.
  • Wrong username format. Most servers want the full email address; some relays want a fixed username.
  • Gmail: the account password instead of an app password. Google needs an app password (which requires 2-Step Verification) or OAuth for SMTP.
  • Gmail: app password revoked. Changing the Google password revokes every app password.
  • Hidden characters. A trailing newline or space copied with the password.
  • Encoding problems. Passwords with non-ASCII characters can be encoded differently by the client and server under AUTH PLAIN or LOGIN.
  • The wrong server. You have a valid login for one provider but point the client at another.

How to fix it

  1. Re-enter the credentials from the source of truth, without spaces or line breaks.
  2. Use the full email address as the username unless your provider says otherwise.
  3. Gmail: turn on 2-Step Verification, create an app password, and use it. Or switch to OAuth. See username and password not accepted.
  4. Postfix or Dovecot you run: check the SASL logs (/var/log/mail.log or journalctl -u postfix) for the reason after “authentication failed”, and test the account with doveadm auth test user@example.com.
  5. Check the host and port. The login must match the server.
  6. Avoid personal passwords in apps. Use a provider API key that you can rotate on its own.

Which server sent it

  • Gmail and Google Workspace send 535-5.7.8 Username and Password not accepted. Google’s own error table prints the code as 5.7.80; the reply clients see reads 5.7.8.
  • Microsoft 365 uses 535 5.7.3 Authentication unsuccessful instead, and 535 5.7.139 when SMTP AUTH is disabled by policy. See 535 5.7.3.
  • Yahoo returns a 535 when the password is wrong; it also needs an app password for third-party apps.
  • Postfix with Dovecot or Cyrus SASL sends 535 5.7.8 Error: authentication failed: plus the SASL reason.

Is it temporary?

No. 535 is a 5xx permanent reply. Retrying the same credentials fails every time, and repeated failures can lock the account or IP out for a while (Gmail: 454 4.7.0 Too many sign-in attempts, try again later). Fix the credentials, then try once.

If the server says 530 instead, you have not logged in at all; see 530 5.7.0.

How Mailcandor handles it

Mailcandor’s SMTP relay uses the username mailcandor and an API key as the password at smtp.mailcandor.com on 465 or 587, so you can rotate a key without touching anyone’s mailbox. When a message bounces, the deliverability coach explains it in plain English and hard bounces are suppressed automatically. Decode any reply with the free bounce code lookup, browse the error library, set up your domain with our SPF, DKIM and DMARC guide, and see more free tools.

Questions

What does 535 5.7.8 mean?

The SMTP server refused your login. RFC 4954 calls it 'Authentication credentials invalid', and says the client should ask for new credentials.

What does p=BadCredentials mean in the Gmail error?

It is the help link Gmail adds to the 535-5.7.8 reply. It means Google did not accept the username and password, usually because an app password or OAuth is required.

Why does 535 5.7.8 happen after it worked before?

The password changed (Google revokes app passwords when the account password changes), the key was rotated, or an admin changed the account's sign-in rules.

Is 535 5.7.8 the same as 535 5.7.3?

Same meaning, different provider. Microsoft 365 uses 535 5.7.3 Authentication unsuccessful for failed logins, and 535 5.7.139 when SMTP AUTH is disabled.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.