Connection settings
- Host
- smtp.gmail.com
- Port
- 587
- Security
- STARTTLS
Gmail's SMTP submission servers are at smtp.gmail.com, available on port 587 (STARTTLS) and port 465 (implicit TLS). Both are equally secure — 587 upgrades the connection after EHLO while 465 negotiates TLS immediately on connect.
Use your full @gmail.com (or Google Workspace) email address as the SMTP username. The "From" address must usually match the authenticated account or an alias configured in Gmail settings.
Recommended settings
- Host:
smtp.gmail.com - Port: 587 (STARTTLS) or 465 (implicit TLS)
- Username: your full Gmail address (e.g.
[email protected]) - Password: a 16-character App Password (required when 2-Step Verification is on)
- Auth method: Auto, PLAIN, or LOGIN all work
Setting up an App Password
Google blocks basic password authentication for accounts with 2-Step Verification enabled. You must generate an App Password instead:
- Go to myaccount.google.com and sign in.
- Navigate to Security → 2-Step Verification (must already be enabled).
- Scroll to "App passwords" at the bottom.
- Select "Mail" as the app, choose a device name (it does not matter which), and click Generate.
- Google shows a 16-character password in groups of four. Copy it exactly — you will not see it again.
- Use this password (without spaces) as the SMTP password in SMTP Tester.
If you do not see the App passwords option, 2-Step Verification is either disabled or your Workspace admin has restricted App Password creation.
Testing with SMTP Tester
- Enter
smtp.gmail.comas the host and select port 587. - Security will auto-set to STARTTLS (or choose 465 with TLS).
- Enter your Gmail address as both the username and the "From" address.
- Paste your App Password into the password field.
- Set the "To" address — use the same address to send to yourself.
- Click Run. The live transcript shows every SMTP line: EHLO, STARTTLS upgrade, AUTH LOGIN, and the server's 235 response on success.
A 235 2.7.0 Accepted response means authentication passed. If you send a message, a 250 2.0.0 OK with a queue ID confirms Gmail accepted it for delivery.
Common errors
535 5.7.8 "Username and Password not accepted"
This is the most common Gmail SMTP error. Causes:
- Using your regular Google password instead of an App Password when 2FA is enabled.
- The App Password was copied with extra spaces or truncated.
- You are trying to authenticate with an account that has been suspended or locked.
- A Google Workspace admin policy blocks "less secure app" access for the organization.
Fix: generate a fresh App Password, copy all 16 characters without spaces, and try again.
534 5.7.9 "Application-specific password required"
Same root cause as 535 — the account has 2-Step Verification but you provided the account password rather than an App Password.
Connection timeout
If the transcript shows no server greeting:
- Port 25 is blocked for Gmail (and most residential/cloud networks). Switch to 587 or 465.
- A corporate firewall may block outbound 587. Try port 465 instead, or ask your IT team to allow
smtp.gmail.comon 587/465.
550 5.7.0 "Mail relay denied" or "Recipient address rejected"
Gmail SMTP is not an open relay. The authenticated account must be allowed to send to the chosen recipient. If you see relay errors, confirm the "From" address matches the authenticated account (or an alias) and that the recipient exists.
Google Workspace (formerly G Suite)
Google Workspace accounts use the same smtp.gmail.com host and ports. The username is your Workspace email address. Your admin may have configured:
- An SMTP relay service (
smtp-relay.gmail.com) for server-side sending — this supports IP-based or certificate-based auth rather than username/password. - Restrictions on which users can generate App Passwords.
- A requirement to use OAuth2 (XOAUTH2) instead of passwords.
For authenticated relay, use smtp-relay.gmail.com on port 587 with STARTTLS. The admin must whitelist the sending IP or domain in the Google Admin console under Apps → Google Workspace → Gmail → Routing → SMTP relay service.
Gmail sending limits
Gmail enforces daily sending limits:
- Free Gmail: 500 messages per day (across SMTP + the web interface).
- Google Workspace: 2,000 messages per day per user.
Exceeding limits triggers a temporary lock — SMTP returns 421 4.7.0 Try again later. Wait 24 hours or use a dedicated transactional provider (SendGrid, Amazon SES, Postmark) for higher volumes.
Security notes
- Always use STARTTLS (587) or implicit TLS (465). Never disable encryption.
- SMTP Tester redacts your password from the live transcript — safe to share or screenshot the output.
- Do not store App Passwords in plain text in codebases. Use environment variables or a secrets manager.