Gmail SMTP Not Working? Fix It Step by Step
In this article
If Gmail SMTP is not working, the most common fix is to stop using your normal Google password and switch to an app password with 2-Step Verification turned on. Gmail's SMTP server (smtp.gmail.com) still works for sending mail from apps and devices, but Google blocks plain-password logins for accounts that have 2-Step Verification enabled, and it also blocks them when "less secure app access" is off. The steps below walk through the correct settings, the app password route, and what to check when authentication keeps failing. Menu labels can differ slightly by app version, device, and region.
What You'll Need
- Your full Gmail address (for example, yourname@gmail.com) and its password.
- A phone or authenticator app to complete 2-Step Verification and generate an app password.
- The exact SMTP settings for the app or device you are configuring: server smtp.gmail.com, port 587 with STARTTLS (or port 465 with SSL/TLS), and authentication required.
- Access to the Google Account security page at myaccount.google.com/security.
Step-by-Step
- Confirm the server and port. In your email client or device, set the outgoing (SMTP) server to smtp.gmail.com. Use port 587 with STARTTLS, or port 465 with SSL/TLS. Do not use port 25; Google does not support it for client submissions. Make sure "Authentication required" or "Use authentication" is enabled.
- Check that 2-Step Verification is on. Sign in at myaccount.google.com, open Security, and look for 2-Step Verification. If it is off, turn it on. Google requires it before it will issue app passwords, and without an app password most clients will be rejected.
- Generate an app password. Still on the Security page, find App passwords (it appears only after 2-Step Verification is enabled). Choose the app (Mail) and the device (Other, then type a name like "Work laptop"), then copy the 16-character password Google shows. This is the password you paste into your email client's SMTP password field, not your normal Gmail password.
- Paste the app password into your client. Open your email app's account settings, find the outgoing server section, and replace the password with the 16-character app password. If the field shows dots, clear it fully and paste again. Save the settings.
- Send a test message. Compose a short email to yourself or another address and send it. If it arrives, SMTP is working. If it fails, note the exact error text (for example "authentication failed" or "connection timed out") before changing anything else.
- Restart the app or device. Close the email client completely and reopen it, or reboot the device. Some clients cache the old credentials until restarted.
- Check your network and firewall. If you are on a corporate, school, or public network, outbound ports 587 and 465 may be blocked. Try a different network (for example, a phone hotspot) to see whether the connection succeeds. On Windows, the built-in firewall or a third-party security suite can also block the client; allow the email app through the firewall if needed.
- Update the app. Install the latest version of your email client from the official source. Older versions may not support current TLS settings and can fail to connect even with correct credentials.
Common Mistakes
- Using the normal Gmail password. With 2-Step Verification on, SMTP requires an app password. The regular password will be rejected.
- Leaving "less secure app access" expectations in place. Google has removed that option for most accounts; do not rely on it. Use an app password instead.
- Wrong port and encryption pairing. Port 587 must go with STARTTLS, and port 465 with SSL/TLS. Mixing them (for example, 587 with SSL) causes connection or handshake errors.
- Typing the app password with spaces. Google displays it in groups of four characters for readability; paste it without spaces.
- Revoked app password. If you removed the app password in your Google Account or changed your Google password, the old app password stops working. Generate a new one.
- Wrong username format. Use the full Gmail address as the SMTP username, not just the part before the @ sign.
Tips
- Keep a note of which app password belongs to which device so you can revoke one without affecting the others.
- If your email client has a "Test connection" or "Verify settings" button, use it after saving; it often reports the exact failure reason.
- For scripts and website contact forms, store the app password in an environment variable or secrets manager rather than in plain text in the code.
- If you send from a custom domain through Gmail, make sure the "From" address is added and verified in Gmail's Send mail as settings; otherwise Gmail may reject or rewrite the sender.
- Check Google Workspace status if you use a work or school account: an admin may have disabled SMTP or app passwords for the organization.
Troubleshooting
If sending still fails, work through these checks in order. First, read the error message carefully. "Username and password not accepted" almost always means the app password is wrong, revoked, or was pasted with spaces. Generate a fresh app password and try again. "Connection timed out" or "could not connect to server" points to a network or port problem: confirm the port and encryption pairing, then try another network. "SSL/TLS handshake failed" usually means the client is too old or the encryption setting does not match the port. Update the app and set 587 with STARTTLS or 465 with SSL/TLS.
If you use a work or school Google Account, ask the administrator whether SMTP and app passwords are allowed; organization policies can block both. If you recently changed your Google password, all app passwords may have been revoked, so create a new one. If the account has Advanced Protection enabled, app passwords may not be available; use an OAuth-based sign-in method in your client instead if it supports one.
As a last resort, remove the account from the email client and add it again from scratch, entering the app password during setup. This clears corrupted saved settings. Do not factory reset your device for an SMTP problem; it deletes data and rarely helps.
Frequently Asked Questions
Why does Gmail SMTP reject my password?
Because Gmail requires an app password when 2-Step Verification is on. Your normal password will not work for SMTP. Generate an app password and use that instead.
Which port should I use for Gmail SMTP?
Use 587 with STARTTLS, or 465 with SSL/TLS. Port 25 is not supported for client submissions.
Do I need 2-Step Verification to use Gmail SMTP?
Yes, to create an app password you need 2-Step Verification enabled on the Google Account. Without it, most clients cannot authenticate.
Can I use Gmail SMTP on a work or school account?
Only if your administrator allows it. Workspace admins can disable SMTP and app passwords for the whole organization.
What if my app password stops working?
It was likely revoked when you changed your Google password or removed it from your account. Create a new app password and update your client.
Is "less secure app access" still an option?
No, Google has removed it for most accounts. Use an app password with 2-Step Verification instead.