535-5.7.8 Username and Password not accepted: Gmail SMTP fix
The error 535-5.7.8 Username and Password not accepted means Google rejected the login you sent over SMTP. Usually the fix is to turn on 2-step verification, generate an app password, and use that 16-character password instead of your normal one. Shared accounts should use delegation, not shared credentials.
Sohail Hussain9 min readShort answer
- Google rejected the password you sent. Turn on 2-Step Verification, create an app password, and paste it into the SMTP password field instead of your normal Google password.
- If your app supports "Sign in with Google" (OAuth), use that instead; Google recommends it over app passwords. For shared mailboxes, use delegation rather than a shared login.
You tried to add an address by SMTP in Gmail, or relay through smtp.gmail.com, and got this:
Authentication failed. Please check your username/password. Server returned error: "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
Why it happens
535 is the SMTP reply for invalid authentication credentials, and 5.7.8 is the enhanced status code for an authentication failure. The leading 5 means permanent: sending the same login again will fail every time. The rejection comes from Google's server, so it is a sender-side credential problem, not a recipient refusing your mail.
The BadCredentials page is generic and does not say which cause you have. These are the usual ones, most common first:
- You used the normal account password. Google's help says Gmail no longer supports third-party apps or devices that require you to share your Google username and password. Google points to "Sign in with Google" as the safer route.
- 2-Step Verification is off, so no app password exists. Google's help says app passwords can only be used with accounts that have 2-Step Verification turned on.
- The app password was revoked. Google says it revokes your app passwords when you change your Google Account password.
- App passwords are blocked for your account (security-key-only 2SV, a work or school account, or Advanced Protection).
- Several people share one login. Shared credentials clash with 2SV, and the second factor goes to one person's device.
- A typo or a config mismatch, for example in Postfix.
Step-by-step fixes
Fix 1: use "Sign in with Google" if the app offers it
Google's own guidance is that "Sign in with Google" is the way to connect apps to your Google Account, and that app passwords are unnecessary in most cases. If your client has that option, remove the Gmail account from the client and add it again using that button. You skip the password problem entirely.
Fix 2: turn on 2-Step Verification and create an app password
Use this when the app only offers a username and password field (Postfix, a SIEM, a printer, a custom SMTP form).
- Sign in to your Google Account and open Security.
- Turn on 2-Step Verification and finish the setup.
- Open App passwords. The menu location has moved over the years, so search the account settings for "App passwords" if you do not see it.
- Give it a name such as
SMTP clientand create it. - Copy the 16-character password. Google's help says every app password can only be checked once, but you can generate a new one at any time.
- In your client, set the username to your full Gmail address and the password to the app password.
- Enter it as one unbroken string. Microsoft's Gmail setup guide notes that the password is displayed with spaces for readability, and you should ignore the spaces when entering it.
Fix 3: check the server and port
Google's developer documentation lists these SMTP settings for smtp.gmail.com:
| Setting | Value | Notes |
|---|---|---|
| Server | smtp.gmail.com | Same for Gmail and Workspace |
| Port 587 | STARTTLS | Client starts plain, then upgrades |
| Port 465 | Implicit SSL/TLS | Connection is encrypted from the start |
| Username | Full address | For example you@example.com |
| Password | App password | Not your account password |
Google's documentation says that if your client begins with plain text before issuing STARTTLS, you should use smtp.gmail.com:587. A wrong port or security type usually gives a connection or TLS error rather than 535, but a mismatch is worth ruling out. Apple Mail users: Google's POP help says that if the outgoing server field contains smtp.gmail.com:username@gmail.com, change it to just smtp.gmail.com.
Fix 4: create a new app password after a password change
If it worked before and broke after you changed your Google password, the old app password is gone. Create a new one and replace it everywhere it was used. Revoke any app password you no longer use from the same App passwords page.
Fix 5: Postfix relay settings
A valid app password can still fail if the Postfix config is off. In main.cf:
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
In /etc/postfix/sasl_passwd:
[smtp.gmail.com]:587 you@example.com:abcdefghijklmnop
Then run postmap /etc/postfix/sasl_passwd and reload Postfix. Check these in order:
- The brackets around the relay name are present.
- The entry matches
relayhostexactly, including the port. - You ran
postmapafter the last edit, so the.dbfile is fresh. - The password has no spaces.
- The file is readable only by root (
chmod 600), since it holds a credential.
Do not use smtp-relay.gmail.com here
smtp-relay.gmail.com is a different Google Workspace service that authenticates mainly by IP address and needs an admin to configure it. App-password logins go to smtp.gmail.com.
Fix 6: stop sharing one login
If several people tried to add the same Gmail address, the shared password is the problem. Instead:
- Use Gmail's Grant access to your account (delegation) so each person signs in with their own Google account and sends on behalf of the shared address.
- On Workspace, ask your admin about a Google Group or a shared mailbox with individual access.
- If an application (not a person) must send, give it its own app password so you can revoke it without breaking anyone else.
Which cause do you have
| What you see | Likely cause | Fix |
|---|---|---|
| No App passwords option | 2SV off, security-key-only 2SV, work account policy, or Advanced Protection | Fix 2, or Fix 1 |
| Works in the browser, fails in the app | Account password used | Fix 2 |
| Worked, then failed after a password change | App password revoked | Fix 4 |
| Several people, intermittent failures | Shared credentials | Fix 6 |
| Postfix only | Config mismatch, missing postmap, spaces | Fix 5 |
When the App passwords option is missing
Google's help lists the reasons you might not find the option even with 2SV on: 2-Step Verification is set up only for security keys, you are logged into a work, school or other organization account, or your account has Advanced Protection.
Advanced Protection is the hard stop. Google states that apps that use app passwords instead of 2-Step Verification are blocked for users with Advanced Protection, and enrolling revokes existing app passwords. On Workspace, Google says accounts must use OAuth, or 2-Step Verification with an app password for clients that don't support OAuth. If the option is hidden, your admin controls it; ask them.
One app password per app
Create a separate app password for each client or server. Then you can revoke one without breaking the others, and you know which one leaked if something goes wrong.
Checklist before you try again
- 2-Step Verification is on for the account you are logging in with.
- The password field holds a fresh app password, typed without spaces.
- The username is the full address, not just the part before the at sign.
- The server is
smtp.gmail.comwith port 587 (STARTTLS) or 465 (SSL/TLS). - The account password has not changed since the app password was made.
- The account is not under Advanced Protection or an admin policy that blocks app passwords.
- Postfix users:
postmapwas run and the service reloaded.
If nothing works
Contact Google through the help link in the error on a personal account. On Workspace, ask your admin to check the user's security settings and the admin audit log for blocked sign-ins. A suspended account fails every time, and only Google can lift that. Include the exact error string, the time with timezone, the client or server IP, the port, and the steps you already tried.
Subject: SMTP error 535-5.7.8 BadCredentials on smtp.gmail.com
Account: you@example.com
Time of failure: 2026-11-30 14:05 UTC
Client/server IP: 203.0.113.10
Server and port: smtp.gmail.com:587 (STARTTLS)
Error: 535-5.7.8 Username and Password not accepted (BadCredentials)
Already tried: 2-Step Verification is on; created a new app password
and entered it without spaces; confirmed no recent password change.
The App passwords option is / is not available on this account.
Please check whether this sign-in is being blocked and why.
Connecting Gmail to Mailneo
This error is a Google account setting, and Mailneo cannot change it. Where we help is the connection step: Mailneo connects Gmail and Google Workspace by OAuth, so you sign in with Google and no password is pasted. It also supports custom SMTP accounts, where everything above applies, and you can test a connection after adding it. See the email accounts documentation. Mailneo cannot recover a suspended Google account or lift Google's sending limits; it throttles conservatively per provider to stay under them.
Common questions
Can I still turn on "less secure app access"?
No. Google says Gmail no longer supports third-party apps that need your plain username and password, and Workspace says the same. Old advice to switch it on is out of date.
Is an app password the same as my Google password?
No. It is a separate 16-character code that works only for one app or device, and it can be revoked on its own. Your account password does not change.
Why does the same app password work in one app and not another?
Check the spaces, the username (full address) and the server. If one app works and another fails with the same password, the second app has a typo or a stale saved credential. Re-enter it, or create a new app password.
Does a working login mean I can send in bulk?
No. Gmail's own sending limits still apply after login succeeds. Bulk sending from a personal mailbox over SMTP will hit them. See email throttling and rate limits, and the SMTP glossary entry if the codes are new.
Explore: Email Deliverability
Related Articles
Gmail 550-5.7.1 "very low reputation of the sending domain"
The Gmail error 550-5.7.1 "very low reputation of the sending domain" is a reputation block, not an authentication failure, so fixing DKIM alone won't clear it. Confirm SPF, DKIM and DMARC align, read the full bounce for the cause, then cut complaints and send only to engaged, opted-in contacts.
421-4.7.0 Gmail Has Detected This Message Is Suspicious: Fix
The 421-4.7.0 "suspicious due to the nature of the content and/or the links" error means Gmail's content filter rejected your message after DATA, not an authentication check. Remove click tracking or move it to your own domain, drop URL shorteners, check link reputation, then retest with a plain message.
421 4.7.0 Temporary System Problem. Try again later (10)
`421 4.7.0 Temporary System Problem. Try again later (10).` is a temporary Gmail deferral, not a permanent rejection. Google's server asked your sender to retry later. Slow your send rate, let your mail server retry, and check authentication and reputation if the deferrals last more than a day or two.
421-4.7.0 Try again later, closing connection (EHLO): fix
The error "421-4.7.0 Try again later, closing connection. (EHLO)" means Google's SMTP server is temporarily refusing your session, usually because of connection volume, a low-reputation IP, or a weak relay setup. Slow down, reuse one connection, queue with retries, authenticate, and send a real EHLO hostname.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free