Error fix · Email errors

SMTP 534 5.7.9 Application-Specific Password Required (Gmail)

Fix Gmail's "534-5.7.9 Application-specific password required": create an app password, handle Workspace limits, or move the app to OAuth.

Error message534-5.7.9 Application-specific password required

By SiteDownCheck Editorial · Updated November 18, 2026 · 5 min read

Gmail answers with this when an app or script tries to log in to smtp.gmail.com with the account's normal password while the account has 2-Step Verification turned on. Google wants a separate, app-only password, or a token from OAuth, not the one you type into the Google sign-in page.

The exact lines look like this:

534-5.7.9 Application-specific password required. For more information, go to
534 5.7.9  https://support.google.com/mail/?p=InvalidSecondFactor
Net::SMTPAuthenticationError: 534-5.7.9 Application-specific password required.

RFC 4954 originally defines 534 5.7.9 as "Authentication mechanism is too weak". Gmail reuses the code for "plain password not enough for this account". The related 535 5.7.8 Username and Password not accepted means the credentials were checked and rejected; see SMTP 535 authentication failed.

Decision order

  1. Is 2-Step Verification on? If yes, you need an app password or OAuth. If it is off and you still get 534, see step 3.
  2. Can the app use "Sign in with Google" or OAuth? That is Google's preferred route. Many frameworks and SMTP plugins support it.
  3. Is the account allowed to create app passwords? Google documents cases where the option is missing.
  4. Is the app password typed correctly and for the right account?
  5. Is the SMTP configuration correct? Host, port and TLS mode.

Step 1: create the app password

With 2-Step Verification enabled, open https://myaccount.google.com/apppasswords, name the app, and generate. Google shows a 16-character code in four groups. It is displayed once, so paste it straight into your app's password field. Remove the spaces if your library does not strip them.

The username stays the full email address, not the app name. Use the following settings:

SettingValue
Hostsmtp.gmail.com
Port and mode587 with STARTTLS, or 465 with implicit TLS
UsernameFull Gmail or Workspace address
PasswordThe app password

Plain-password "less secure app" access has been turned off by Google, so older tutorials that tell you to enable it no longer apply. Check Google's current documentation for the exact timeline for your account type.

Step 2: when the option is not available

Google documents three situations where app passwords cannot be created even with 2-Step Verification:

  • 2-Step Verification is set up with security keys only.
  • The account belongs to an organization (work or school) and the admin has not allowed it.
  • The account is enrolled in Advanced Protection.

For a Google Workspace account, ask your admin whether app passwords are permitted, or move the integration to OAuth or the Gmail API. Another route is SMTP relay from the Admin console for servers that send as your own domain; see Google's Workspace SMTP relay documentation for the current setup, since it authenticates by IP address or SMTP credentials rather than by a user password.

Step 3: confirm the account is the problem

Test outside your app with swaks, so you know whether the failure is in the password or the code:

swaks --to you@example.net --from you@gmail.com --server smtp.gmail.com --port 587 --tls --auth LOGIN --auth-user you@gmail.com

swaks asks for the password interactively. If this succeeds with the app password and your app still fails, the app has a stale value, an extra space, or is reading a different environment variable. If swaks fails with the same 534, the account does not accept that credential.

A quick check that your network can reach Gmail at all: use nc -vz smtp.gmail.com 587. If it times out rather than failing authentication, the problem is a blocked port; see connection timed out on port 25.

Step 4: move to OAuth for anything long-lived

App passwords are fine for a script or a printer. For products that connect many users' mailboxes, use OAuth 2.0 with the SMTP XOAUTH2 mechanism or the Gmail API. The token can be scoped and revoked per user, and it survives password changes. Google recommends this route over app passwords where the app supports it.

Common causes of repeats after you fixed it

  • Secrets file not reloaded. The service keeps the old value until restarted.
  • Copying with spaces. Some libraries send spaces literally and fail with 535 rather than 534.
  • Wrong sender. Gmail rewrites the From address to the authenticated account unless an alias is configured under "Send mail as". See SMTP 553 sender address rejected for related sender problems.
  • Daily limits. Gmail enforces sending quotas and may respond with different errors when you exceed them. Check Google's current limits before using Gmail for bulk mail.

How to verify

Send a message to an address you control and check the headers for Received: ... by smtp.gmail.com. Use the Email Deliverability Test and the SPF Record Checker to confirm your domain's SPF includes Google if you send with your own domain through Gmail.

Next steps

FAQ

Does an app password replace my Google password?

No. It is an extra credential that works only for sign-ins from apps and devices that cannot show the Google prompt. Your normal password still logs in on the web.

Why does 534 come back after a password change?

Google revokes the account's app passwords when the password changes. Generate a new one and update your app.

Is 534 5.7.9 the same as 535 5.7.8?

No. 534 means the account needs a stronger credential type. 535 means the username and password were checked and not accepted.

Do I need an app password for Google Workspace?

It depends on the admin's settings. Many organizations disable it and require OAuth or the SMTP relay service.

Get notified when this fix updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.