Gmail SMTP Settings for Sending From an App or Device

The short answer
Gmail's SMTP server is smtp.gmail.com. Use port 587 with STARTTLS or port 465 with SSL/TLS. Authentication requires an App Password (generated once in Google Account settings) or OAuth 2.0 — Google removed plain-password access in May 2022. Your username is always your full Gmail address.
Gmail SMTP settings: smtp.gmail.com, port 587 (STARTTLS) or 465 (TLS), App Password or OAuth required since Less Secure App access was removed in 2022.
On this page
Configuring Gmail SMTP is a short task once you have the right server, port, and credential. The server address and ports have not changed in years. What did change is authentication: Google ended plain-password access through its Less Secure Apps setting in May 2022, so the password you use to sign in to Gmail no longer works in an SMTP client. That single fact is behind most Gmail SMTP failures today.
This guide covers the current Gmail SMTP settings for consumer accounts and Google Workspace, explains which port to choose, walks through the App Password setup that authentication now requires, and gives a troubleshooting table for the errors you're most likely to hit.
The short answer#
Gmail's outbound SMTP server is smtp.gmail.com. Port 587 with STARTTLS is the current recommended choice and works with nearly all modern clients. Port 465 with SSL/TLS also works and is the better option for older firmware that cannot negotiate STARTTLS. Port 25 is blocked by Google for outbound on consumer accounts; in Google Workspace it is available for SMTP relay but not for direct client access.
The credential that goes in the Password field is not your Gmail password. It is a 16-character App Password you generate once at myaccount.google.com, or it is your account connected via OAuth 2.0 (the 'Sign in with Google' popup). Without one of those, authentication fails with a 535 error and no mail goes out.
Before you start#
Two prerequisites determine whether any of the steps below will work. Check both before opening your app's settings.
- 2-Step Verification must be turned on. App Passwords only exist on accounts where 2SV is active. Go to myaccount.google.com, open Security, and confirm it shows '2-Step Verification: On'. If it doesn't, enable it first — the App Passwords option won't appear until you do.
- Generate one App Password per app or device. In Google Account under Security, open App Passwords. Give it a descriptive name such as 'Thunderbird' or 'office scanner', click Create, and copy the 16-character code shown. This code appears only once. Paste it into your app's password field exactly as shown, without spaces.
- Google Workspace accounts may need admin action. Your Workspace admin must enable SMTP access at the account or organisational-unit level in the Admin Console. If you manage your own Workspace, check Apps > Google Workspace > Gmail > Advanced settings before assuming the settings are wrong.
- Know your app's port preference. Most modern desktop clients default to port 587. Some older scanner firmware supports only port 465 or port 25 — Google blocks 25 for outbound on consumer accounts, so if your device requires port 25 you'll need a Workspace account with SMTP relay configured.
How to configure Gmail SMTP, step by step#
Work through these steps in order. Have your App Password ready before you open the app's settings — the field accepts it exactly once during setup, and some apps hide it after saving.
- 1
Open your app's outgoing mail settings
Find the account or mail settings section. Look for SMTP, Outgoing Mail Server, or Relay settings — different apps use different labels but every one of them needs the same five values: server address, port, encryption type, username, and password.
- 2
Enter the server address and port
Server: smtp.gmail.com. Port: 587 if you want STARTTLS (recommended), or 465 if you want SSL/TLS. If there is an Encryption or Security dropdown, select STARTTLS for port 587 or SSL/TLS for port 465. Do not leave the encryption field blank — an unencrypted connection to port 587 will fail.
- 3
Enter your credentials
Username: your full Gmail address, including the @gmail.com or @yourdomain.com part. Password: the 16-character App Password you generated, not your regular Gmail account password. If your app offers a 'Sign in with Google' button instead, use that — it connects via OAuth 2.0 and no App Password is needed.
- 4
Test the connection before saving
Most clients have a Test or Verify button. Use it. A successful test means the SMTP server accepted your credentials and encryption handshake. A failure returns an error code — 535 means authentication rejected, a timeout usually means the wrong port or a firewall, and an SSL error means the wrong encryption type for that port.
- 5
Send a test message
Even after a passing connection test, send one real message to confirm the full delivery path. Check that it arrives and that the From address shows your Gmail address correctly. If it doesn't arrive, check the sending account's Sent folder to confirm the message left Gmail's servers.
App Passwords are single-purpose credentials
Port and encryption by client type#
Not every client or device handles SMTP the same way. The table below gives the right starting point for common setups. Workspace-specific options are noted where they differ from consumer Gmail.
| Client or device | Port | Encryption | Notes |
|---|---|---|---|
| Desktop mail client (Thunderbird, Apple Mail, Outlook) | 587 | STARTTLS | Use OAuth 2.0 if the client supports it; App Password otherwise |
| Google Workspace SMTP relay | 587 (or 25 if admin-allowlisted) | TLS | Admin enables relay in Admin Console; authenticate with OAuth or IP allowlist |
| Printer or MFP scanner | 587 | STARTTLS | Most firmware from 2019 onward supports 587; fall back to 465 if unavailable |
| IoT device or legacy appliance | 465 | SSL/TLS | Older firmware rarely negotiates STARTTLS; 465 with SSL is the safer starting point |
| Custom application or script | 587 | STARTTLS | App Password works; OAuth client credentials are more robust for production code |
| Modern SaaS or CRM | OAuth 2.0 (Gmail API) | N/A | Most SaaS apps use the Gmail OAuth flow, not a raw SMTP credential |
What to do when Gmail SMTP authentication fails#
Most Gmail SMTP failures share a small set of root causes. The error code in your client narrows it down quickly — work the table from your symptom.

| Error or symptom | Likely cause | Fix |
|---|---|---|
| 535 — Username and password not accepted | Regular Gmail password used instead of an App Password | Generate an App Password at myaccount.google.com and use that in the Password field |
| 535 — SMTP AUTH failed after enabling 2SV | App Password generated before 2SV was enabled, or 2SV toggled off and back on | Delete the old App Password, generate a new one, and update the credential in your app |
| Connection timeout on port 25 | Google blocks port 25 for outbound on consumer accounts | Switch to 587 (STARTTLS) or 465 (SSL/TLS); use Workspace SMTP relay if port 25 is a hard requirement |
| SSL certificate error or TLS handshake failure | Encryption type does not match the port | Port 587 requires STARTTLS; port 465 requires SSL/TLS. Check the Encryption or Security dropdown and match it to the port |
| Works initially, then stops sending | Daily sending limit reached: 500/day for personal Gmail, up to 2,000/day for Workspace (as of July 2026) | Wait for the 24-hour window to reset. For bulk sends, use a dedicated email service provider rather than Gmail SMTP |
| Workspace account rejected despite correct credentials | Workspace admin has not enabled SMTP client access | Ask your admin to enable it in Admin Console under Apps > Google Workspace > Gmail > Advanced settings |
| App Password option is missing in Google Account | 2-Step Verification is not enabled on the account | Enable 2SV first under Google Account > Security, then return to generate an App Password |
Sending limits apply per account, not per app
A faster way: connect Gmail without SMTP credentials#
Configuring SMTP once is manageable, but it breaks in predictable ways: an App Password that gets revoked, a new device that needs its own credential, or a scanner that silently fails after a firmware update. The ongoing maintenance is the part that costs time.
AI Emaily connects to Gmail using OAuth 2.0 directly — the same 'Sign in with Google' flow Google recommends — so there is no SMTP server address to enter, no port to choose, and no App Password to generate or rotate. Your mail moves through Google's authenticated transport, your Google Account security settings stay intact, and the connection persists without manual renewal. You get a unified inbox across Gmail, Outlook, and IMAP accounts in the same interface, with Manual, Copilot, and Autopilot modes for how much the AI handles.
We build AI Emaily. It is available on a 7-day free trial — see aiemaily.com/pricing for what the Pro and Autopilot plans include.
Frequently asked
See it in AI Emaily
Keep reading
Sources

Written by
Nafiul HasanNafiul Hasan is an entrepreneur and AI automation system builder with 10+ years of experience turning messy, manual workflows into reliable automated systems. He designs and ships AI enterprise solutions end-to-end — the agent logic, the data plumbing, and the product people actually use — and founded AI Emaily to give busy professionals their attention back. He writes here from the builder's seat: what works, what breaks, and how to put AI to work without giving up control.