Sending emails directly from your website, application, or custom software is a common requirement for modern digital products. For small-scale use cases, Gmail’s SMTP server provides a simple and free way to send emails without relying on paid third-party services.
Important Security Changes
Due to updated security policies by Google, Gmail SMTP no longer supports traditional password-based login.
To use Gmail SMTP, you must:
- Enable 2-Step Verification (2FA)
- Generate a 16-character App Password
- Use the App Password instead of your Gmail password
The “Less Secure Apps” feature was fully removed in 2025, making App Passwords mandatory for SMTP access.
Generate a Gmail App Password
Step 1: Go to your Google Account → Security

Step 2:
- Enable 2-Step Verification (2FA)
- Navigate to App Passwords

Step 3: Select:
- App: Mail
- Or choose “Other” and name it( e.g., Smtp test)

Step 4: Click Generate
Note: Copy the 16-character password (it will not be shown again)
Configure Gmail SMTP
In your website, app, or CMS (e.g., WordPress SMTP plugins), enter:
- SMTP Host: smtp.gmail.com
- Port: 587
- Encryption: TLS
- Username: Your Gmail address
- Password: Generated App Password
- From Email: Same as your Gmail address
After configuration, send a test email to verify everything is working correctly.
SMTP Configuration Table
Use the following settings to configure Gmail SMTP in your application:
| Field | Recommended Value |
|---|---|
| SMTP Server | smtp.gmail.com |
| Port | 587 (TLS) (recommended) |
| Alternative Port | 465 (SSL) |
| Security | TLS (STARTTLS) / SSL |
| Username | Your full Gmail address |
| Password | App Password (not Gmail password) |
| From Email | Same as Gmail address |
| Authentication | Required |
- Use Port 587 with TLS (STARTTLS) for best compatibility and security
- Use Port 465 with SSL only if TLS is not supported by your tool