update Updated January 2026 8 min read

Gmail SMTP Settings (2026)

Complete guide to configure Gmail SMTP for sending emails from your application, website, or device. Includes App Password setup, code examples, and troubleshooting.

table_chart Quick Reference

Setting Value
SMTP Server smtp.gmail.com
Port (TLS/STARTTLS) 587 Recommended
Port (SSL) 465
Encryption Required (TLS or SSL)
Username Your full Gmail address (example@gmail.com)
Password App Password (not your regular password)
Authentication Required (OAuth 2.0 or App Password)
Daily Limit (Personal) 500 emails/day
Daily Limit (Workspace) 2,000 emails/day
warning

Important: Authentication Change (May 2025)

Google has deprecated "Less Secure Apps" access. You must use either App Passwords (with 2FA enabled) or OAuth 2.0 to authenticate. Regular Gmail passwords will not work for SMTP.

checklist Prerequisites

Before configuring Gmail SMTP, ensure you have:

  • check_circle A Google account (Gmail or Google Workspace)
  • check_circle 2-Factor Authentication enabled (required to generate App Passwords)
  • check_circle An App Password generated for your application

Google Workspace users: Your admin may need to enable SMTP access and allow App Passwords in the Admin Console.

format_list_numbered Step-by-Step Setup

1

Enable 2-Factor Authentication

  1. Go to myaccount.google.com/security
  2. Find "2-Step Verification" under "How you sign in to Google"
  3. Click "Get started" and follow the prompts
  4. Choose your verification method (phone, authenticator app, or security key)

info If you don't see this option, your Workspace admin may have disabled it.

2

Generate an App Password

  1. Go to myaccount.google.com/apppasswords
  2. You may need to sign in again
  3. Enter a name for the App Password (e.g., "My SMTP App")
  4. Click "Create"
  5. Copy the 16-character password (spaces are optional)

Important: Save this password immediately. Google will not show it again. If you lose it, you'll need to generate a new one.

3

Configure Your Application

Use these settings in your email client or application:

SMTP Server

smtp.gmail.com

Port

587 (TLS)

Username

your.email@gmail.com

Password

Your App Password

code Code Examples

# Python 3 - Gmail SMTP with smtplib
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

# Gmail SMTP Configuration
SMTP_SERVER = "smtp.gmail.com"
SMTP_PORT = 587
GMAIL_ADDRESS = "your.email@gmail.com"
APP_PASSWORD = "xxxx xxxx xxxx xxxx"  # Your 16-char App Password

def send_email(to_email, subject, body):
    # Create message
    msg = MIMEMultipart()
    msg['From'] = GMAIL_ADDRESS
    msg['To'] = to_email
    msg['Subject'] = subject
    msg.attach(MIMEText(body, 'plain'))

    try:
        # Connect and send
        server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
        server.starttls()  # Enable TLS encryption
        server.login(GMAIL_ADDRESS, APP_PASSWORD)
        server.sendmail(GMAIL_ADDRESS, to_email, msg.as_string())
        server.quit()
        print("Email sent successfully!")
    except Exception as e:
        print(f"Error: {e}")

# Usage
send_email("recipient@example.com", "Test Subject", "Hello from Gmail SMTP!")

speed Sending Limits & Quotas

Account Type Daily Limit Recipients/Message Notes
Personal Gmail 500 500 Rolling 24-hour window
Google Workspace 2,000 100 via SMTP Up to 10,000 total recipients/day
Workspace Trial 500 100 60-day waiting period after conversion
SMTP Relay (Workspace) 10,000 Per user Requires admin setup

Important Quota Details

  • info Each recipient counts separately toward your daily limit (one email to 10 recipients = 10 emails)
  • info Aliases (yourname+tag@gmail.com) share the same quota as the primary account
  • info SMTP sends count toward web interface limits (they share the same quota)
  • info Unofficial rate limit: ~20 emails per hour for burst sending (not documented by Google)

error Common Errors & Solutions

535 5.7.8

Authentication Failed

Username and Password not accepted

Solution: You're using your regular password instead of an App Password. Generate an App Password at myaccount.google.com/apppasswords

550 5.4.5

Daily Sending Quota Exceeded

Daily user sending quota exceeded

Solution: Wait 24 hours for the quota to reset. Consider upgrading to Google Workspace for higher limits, or use a dedicated email service like Amazon SES or SendGrid.

421

Too Many Concurrent Connections

Server temporarily unavailable

Solution: Reduce the number of simultaneous SMTP connections. Add delays between emails (1-2 seconds). Use connection pooling with a maximum of 10 concurrent connections.

Connection Timeout

Connection Timeout / Refused

Cannot connect to smtp.gmail.com

Solution: Check if your ISP or firewall blocks port 587/465. Try using port 465 (SSL) instead of 587 (TLS). Verify you have the correct server address (smtp.gmail.com).

business Google Workspace vs Personal Gmail

Feature Personal Gmail Google Workspace
SMTP Server smtp.gmail.com smtp.gmail.com or smtp-relay.gmail.com
Daily Limit 500 emails 2,000 emails (up to 10,000 with relay)
Admin Control None Full control via Admin Console
SMTP Relay Not available Available (IP-based auth)
Custom Domain No (@gmail.com only) Yes (@yourdomain.com)
SLA None 99.9% uptime

Google Workspace SMTP Relay

For higher volume sending, Workspace admins can configure SMTP Relay:

  • Server: smtp-relay.gmail.com
  • Ports: 25, 465, or 587
  • Auth: IP-based (no password required)
  • Limit: 10,000 recipients/day per user

shield Security Best Practices

check_circle

Use Environment Variables

Never hardcode App Passwords in your code

check_circle

One App Password Per App

Create separate passwords for each application

check_circle

Revoke Unused Passwords

Regularly audit and remove old App Passwords

check_circle

Consider OAuth 2.0

For production apps, OAuth is more secure than App Passwords

Never commit App Passwords to Git! Add your config files to .gitignore and use secrets management in production.

help Frequently Asked Questions

Can I use my regular Gmail password for SMTP?

No. Since May 2025, Google requires either an App Password (with 2FA enabled) or OAuth 2.0 authentication. Your regular password will not work and will result in a 535 authentication error.

Should I use port 587 or 465?

Port 587 with STARTTLS is recommended. It's the modern standard and more widely supported. Use port 465 (implicit SSL) only if 587 is blocked by your network or firewall.

Why am I hitting rate limits with only a few emails?

Gmail has an undocumented burst rate limit of approximately 20 emails per hour for new or low-volume senders. Add delays of 3-5 seconds between emails to avoid triggering this limit.

Is Gmail SMTP suitable for bulk email?

No. Gmail SMTP is designed for personal and transactional email, not bulk marketing. For bulk email, use dedicated services like Amazon SES, SendGrid, or Mailgun which offer higher limits and better deliverability for marketing campaigns.

How long until my quota resets?

Gmail uses a rolling 24-hour window. Your limit resets gradually as emails "age out" of the 24-hour period. There's no fixed reset time like midnight.

Need Higher Sending Limits?

Gmail SMTP is limited to 500-2,000 emails/day. For higher volume email campaigns with better deliverability, try Postigo's automated email platform.