Gmail’s IMAP connection can fail in Outlook with errors like “The IMAP server has terminated the connection” or “Login to IMAP server failed.” This guide walks you through the most common causes — from app passwords to folder sync settings — and shows you how to fix them so your Gmail works reliably in Outlook.
What You’ll Need
- Your Gmail email address and password (or an app password if you have 2-Step Verification enabled)
- Access to your Gmail account in a web browser
- Outlook installed on your computer (any recent version)
Step-by-Step
- Enable IMAP in Gmail
Open Gmail in your browser, click the gear icon, then “See all settings.” Go to the “Forwarding and POP/IMAP” tab. In the IMAP access section, select “Enable IMAP” and click “Save Changes.” If it was already enabled, toggle it off, save, then re-enable it to reset the connection. - Generate an App Password (if using 2-Step Verification)
If you have 2-Step Verification on, Google requires an app-specific password for Outlook. Go to your Google Account, select “Security,” then “App passwords” (you may need to sign in again). Create a password for “Mail” and “Other (custom name)” — name it “Outlook.” Copy the 16-character password. Use this in Outlook instead of your regular Gmail password. - Update Outlook’s Account Settings
In Outlook, go to File > Account Settings > Account Settings. Select your Gmail account and click “Change.” Ensure the incoming and outgoing server settings are correct:
Incoming (IMAP): imap.gmail.com, port 993, SSL/TLS
Outgoing (SMTP): smtp.gmail.com, port 587, STARTTLS (or 465 with SSL)
Enter your full Gmail address as the username, and the app password (or normal password if no 2FA). Click “More Settings” > “Outgoing Server” and check “My outgoing server (SMTP) requires authentication.” Also go to the “Advanced” tab and confirm the ports and encryption match above. - Clear the Outlook Credential Cache
If you previously entered a wrong password, Outlook may keep it. Open Windows Credential Manager (search in Start menu). Under “Windows Credentials,” find entries like “MicrosoftOffice16_Data:IMAP:imap.gmail.com” or similar. Remove them. Restart Outlook and re-enter your password when prompted. - Check Gmail’s IMAP Folder Settings
In Gmail settings, under the IMAP access section, look for “Folder size limits.” If you have many large emails, the sync may time out. Set “Limit IMAP folders to” to a reasonable number (e.g., 1000) and “Folder size limits” to a value like 5000 messages. Save changes. - Repair the Outlook Data File
Outlook’s local cache for Gmail can get corrupted. Close Outlook, then open the Control Panel > Mail (32-bit) > Data Files. Locate the .ost file for your Gmail account, note its path, then delete it (or rename it to .old). Restart Outlook — it will recreate the file and re-sync. This often fixes “terminated connection” errors. - Disable Antivirus or Firewall Interference (Temporarily)
Some security software blocks IMAP connections. Temporarily disable your antivirus or firewall, then try sending/receiving in Outlook. If it works, add Outlook and imap.gmail.com to the exception list. - Re-add the Gmail Account
If nothing else works, remove the account entirely from Outlook (File > Account Settings > Account Settings > select Gmail > Remove). Then close Outlook, reopen, and add the account again using the correct settings. Make sure to use the app password if applicable.
Common Mistakes
- Using your regular Gmail password with 2FA: This will always fail. You must use an app password.
- Wrong port or encryption: Using port 995 (POP) or SSL on port 587 will cause errors. Double-check the exact values.
- Leaving “Require logon using Secure Password Authentication” checked: Gmail does not support SPA. In More Settings > Advanced, ensure that box is unchecked.
- Not enabling IMAP in Gmail: If IMAP is off, Outlook cannot connect at all.
- Ignoring the “Folder size limits” setting: Huge folders can cause timeouts and disconnections.
Tips
- Keep your Outlook and Gmail app passwords updated — if you regenerate the app password, update it in Outlook immediately.
- Use the “Send/Receive” tab to set a shorter sync interval (e.g., every 5 minutes) to reduce connection drops.
- If you have multiple Gmail accounts, repeat the steps for each one.
- Consider using the Gmail offline feature in the browser if Outlook continues to be problematic.
Troubleshooting
If you still get errors after following the steps:
- Error “Login to IMAP server failed”: Re-check your password. If you have 2FA, generate a new app password and try again. Also, ensure you’re using the full email address as the username.
- Error “The IMAP server has terminated the connection”: This often means the folder size limit is too high. Reduce it in Gmail settings. Also, try deleting the .ost file as described.
- Outlook hangs on “Disconnected”: Check your internet connection. Try restarting Outlook and your computer. If on a VPN, disconnect and reconnect.
- Gmail works in browser but not Outlook: This indicates an Outlook-specific issue — clear credentials, repair the data file, or re-add the account.
- If all else fails: Create a new Outlook profile (Control Panel > Mail > Show Profiles > Add) and set up Gmail from scratch. This isolates any profile corruption.
Frequently Asked Questions
Why does Outlook keep asking for my Gmail password?
This usually happens when you have 2-Step Verification enabled and are using your regular password, or when the stored credential is outdated. Generate an app password and use it, and clear the Windows Credential Manager entries for Gmail.
Can I use Gmail IMAP with Outlook for free?
Yes, Gmail’s IMAP access is free for personal accounts. You just need to enable it in Gmail settings and configure Outlook correctly.
What is the difference between IMAP and POP in Outlook?
IMAP syncs folders and messages across devices, keeping everything in sync with the server. POP downloads emails to one device and typically removes them from the server. For Gmail, IMAP is recommended.
Will fixing the IMAP error delete my emails?
No. The steps here only affect the connection and local cache. Your emails remain on Gmail’s servers. Deleting the .ost file only forces a re-sync, not data loss.
Why does Gmail work on my phone but not in Outlook?
Phone apps often use OAuth (which is more secure) while Outlook may use basic authentication. If you have 2FA, you need an app password specifically for Outlook. Also, ensure IMAP is enabled — phone apps might use a different protocol.
How do I find my Gmail app password?
Go to myaccount.google.com > Security > App passwords. You’ll need 2-Step Verification enabled. Select “Mail” as the app and “Other” as the device, then generate. It will show a 16-character code — use that in Outlook.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- iOS 18 Safari Not Working? Fixes That Help
- How to Check Your Linux Kernel for Spectre
- iPhone Safe Mode: How to Enable or Disable It
- Fix Slow Internet Lag on Samsung Galaxy Note
- iPhone Personal Hotspot: How to Use It
- Google Play Protect: How It Secures Your Android