Cannot Connect to Mail Server? 7 Steps to Fix It
A 'cannot connect to mail server' error stops your email client from sending or receiving. This step-by-step guide covers every common cause — wrong settings, blocked ports, SSL issues — and how to fix each one.
- Step 1: Confirm Your Internet Connection Is Working
- Step 2: Verify Your Server Address and Port
- Step 3: Check Your Username and Password
- Step 4: Check If the Port Is Blocked by Your Network
- Step 5: Disable Antivirus / Firewall Email Scanning Temporarily
- Step 6: Check the Mail Server's Status
- Step 7: Remove and Re-add Your Email Account
- When to Call Your Hosting Provider
When your email client shows "Cannot connect to mail server", "Connection timed out", or "Server not found", it means it failed to establish a connection with the incoming (IMAP/POP3) or outgoing (SMTP) server. Here's how to diagnose and fix it systematically.
Step 1: Confirm Your Internet Connection Is Working
Before anything else — open a browser and load a webpage. If that fails too, the problem is your internet connection, not your email settings. Restart your router, wait 30 seconds, and try again.
Step 2: Verify Your Server Address and Port
The most common cause of connection failures is a wrong server address or port number. Check your email client settings against these known-good values:
Gmail
| Type | Server | Port | Security |
|---|---|---|---|
| IMAP (incoming) | imap.gmail.com | 993 | SSL/TLS |
| SMTP (outgoing) | smtp.gmail.com | 587 | STARTTLS |
Outlook / Hotmail / Microsoft 365
| Type | Server | Port | Security |
|---|---|---|---|
| IMAP (incoming) | outlook.office365.com | 993 | SSL/TLS |
| SMTP (outgoing) | smtp.office365.com | 587 | STARTTLS |
cPanel / Web Hosting
| Type | Server | Port | Security |
|---|---|---|---|
| IMAP (incoming) | mail.yourdomain.com | 993 | SSL/TLS |
| SMTP (outgoing) | mail.yourdomain.com | 587 | STARTTLS |
For cPanel hosting, also confirm the exact server hostname with your hosting provider — using your domain name directly is correct only if an SSL certificate is installed for it.
Step 3: Check Your Username and Password
Try logging in to the webmail version of your account (e.g. mail.google.com, outlook.com, or your host's webmail URL). If webmail login fails, your password has changed or the account has a problem — reset it there first.
If you use Gmail or Microsoft 365 with two-factor authentication, you must use an App Password in your email client — your regular account password won't work.
Step 4: Check If the Port Is Blocked by Your Network
Some ISPs, corporate networks, and school networks block SMTP and IMAP ports as a spam-prevention measure. To test if port 993 or 587 is reachable:
- Visit portchecker.co and test your mail server IP on ports 993 and 587
- If blocked, try switching to an alternative port:
- IMAP: try port 143 with STARTTLS instead of 993 with SSL
- SMTP: try port 465 with SSL instead of 587 with STARTTLS
- If on a corporate network, contact your IT department to whitelist the mail server
Step 5: Disable Antivirus / Firewall Email Scanning Temporarily
Antivirus programs (especially Avast, AVG, ESET, Kaspersky) often intercept mail connections for scanning. This can break SSL handshakes and cause connection failures.
Fix: Open your antivirus settings, find "Email scanning" or "Mail shield" and temporarily disable it. Then test your email client. If the connection succeeds, add your email client as an exception in the antivirus settings rather than leaving scanning disabled.
Step 6: Check the Mail Server's Status
Sometimes the problem isn't on your side at all — the mail server is down or experiencing issues.
- Gmail: Check workspace.google.com/status
- Microsoft 365: Check status.office.com
- Shared hosting: Check your provider's status page or contact their support
Step 7: Remove and Re-add Your Email Account
Corrupted account settings in your email client can cause persistent connection failures even when all the settings look correct. Remove the account entirely, restart the email client, and add the account fresh from scratch.
Before removing: note down all your server settings (or take a screenshot) so you can re-enter them accurately.
When to Call Your Hosting Provider
If all steps above check out and you still can't connect, the issue is likely server-side. Contact your hosting provider and give them:
- The full error message your email client shows
- The server address and port you're connecting to
- The email client you're using (Outlook, Thunderbird, Apple Mail, etc.)