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
- Re-enter the credentials from the source of truth, without spaces or line breaks.
- Use the full email address as the username unless your provider says otherwise.
- Gmail: turn on 2-Step Verification, create an app password, and use it. Or switch to OAuth. See username and password not accepted.
- Postfix or Dovecot you run: check the SASL logs (
/var/log/mail.logorjournalctl -u postfix) for the reason after “authentication failed”, and test the account withdoveadm auth test user@example.com. - Check the host and port. The login must match the server.
- 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 unsuccessfulinstead, and535 5.7.139when 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.