Blog/ Gmail how-tos

Gmail SMTP Settings for Sending From an App or Device

Nafiul HasanNafiul Hasan· 9 min read
AI Emaily blog cover for Gmail SMTP settings, showing smtp.gmail.com port and encryption configuration for connecting an app or device to Gmail outbound mail

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
  1. 01The short answer
  2. 02Before you start
  3. 03How to configure Gmail SMTP, step by step
  4. 04Port and encryption by client type
  5. 05What to do when Gmail SMTP authentication fails
  6. 06A faster way: connect Gmail without SMTP credentials

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. 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. 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. 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. 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. 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

Each App Password you generate is independent of your main Gmail password. If a device is lost or an app is compromised, revoke only that App Password in Google Account settings — your other apps and your main account are unaffected. Treat each one like a separate key: one per device, one per app.

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 devicePortEncryptionNotes
Desktop mail client (Thunderbird, Apple Mail, Outlook)587STARTTLSUse OAuth 2.0 if the client supports it; App Password otherwise
Google Workspace SMTP relay587 (or 25 if admin-allowlisted)TLSAdmin enables relay in Admin Console; authenticate with OAuth or IP allowlist
Printer or MFP scanner587STARTTLSMost firmware from 2019 onward supports 587; fall back to 465 if unavailable
IoT device or legacy appliance465SSL/TLSOlder firmware rarely negotiates STARTTLS; 465 with SSL is the safer starting point
Custom application or script587STARTTLSApp Password works; OAuth client credentials are more robust for production code
Modern SaaS or CRMOAuth 2.0 (Gmail API)N/AMost 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.

Diagram showing Gmail SMTP configuration options: port 587 with STARTTLS selected versus port 465 with SSL/TLS, illustrating how the encryption setting must match the chosen port
Port and encryption must match: STARTTLS for 587, SSL/TLS for 465. Mismatching the two is one of the most common configuration errors.
Error or symptomLikely causeFix
535 — Username and password not acceptedRegular Gmail password used instead of an App PasswordGenerate an App Password at myaccount.google.com and use that in the Password field
535 — SMTP AUTH failed after enabling 2SVApp Password generated before 2SV was enabled, or 2SV toggled off and back onDelete the old App Password, generate a new one, and update the credential in your app
Connection timeout on port 25Google blocks port 25 for outbound on consumer accountsSwitch to 587 (STARTTLS) or 465 (SSL/TLS); use Workspace SMTP relay if port 25 is a hard requirement
SSL certificate error or TLS handshake failureEncryption type does not match the portPort 587 requires STARTTLS; port 465 requires SSL/TLS. Check the Encryption or Security dropdown and match it to the port
Works initially, then stops sendingDaily 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 credentialsWorkspace admin has not enabled SMTP client accessAsk your admin to enable it in Admin Console under Apps > Google Workspace > Gmail > Advanced settings
App Password option is missing in Google Account2-Step Verification is not enabled on the accountEnable 2SV first under Google Account > Security, then return to generate an App Password

Sending limits apply per account, not per app

Google counts outbound volume against the sending account regardless of how many apps or devices share the same SMTP credential. A personal @gmail.com account is limited to 500 messages per 24 hours. Hitting this limit temporarily blocks all outbound from that account — including mail sent through Gmail's own web interface — until the window resets.

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

Nafiul Hasan

Written by

Nafiul Hasan

Nafiul 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.

EntrepreneurAI Automation System BuilderAI EnthusiastBuilds AI Enterprise Solutions10+ years experience
More from Nafiul
Ready when you are

Connect Gmail without managing SMTP credentials.

AI Emaily connects to Gmail, Outlook and IMAP accounts via OAuth 2.0 — no server address, no port, no App Password to generate or rotate. Manage every inbox in one interface with approve-before-send, undo and a full audit trail. Try it free for 7 days.

  • 7-day free trial
  • Cancel anytime
  • Every provider