- How to Fix “Could Not Connect to SMTP Host” Error in WP Mail SMTP (2025 Guide)
Introduction:
Are your WordPress emails failing to send? Seeing the dreaded “Could Not Connect to SMTP Host” error message in your WP Mail SMTP plugin?
Don’t worry, this is one of the most common issues WordPress users face while setting up email delivery. It usually looks like this:
Mailer: SMTP (Other)
SMTP Error: Could not connect to SMTP host.
stream_socket_enable_crypto(): Peer certificate CN=`mail.domainname' did not match expected CN=`smtp.gmail.com'
At CloudCareHost.com, we’ve helped countless clients troubleshoot this exact problem. This complete 2025 guide explains every possible cause and how to fix it step-by-step, whether you’re using Gmail SMTP, cPanel, or a VPS server.
Why the “Could Not Connect to SMTP Host” Error Appears
This error means your WordPress website can’t connect securely to the mail server. It can happen due to:
• SSL mismatch between your SMTP host and server (e.g., mail.domainname vs smtp.gmail.com)
- • Firewall blocking outgoing connections on SMTP ports
• Closed or filtered ports (465 or 587)
• Invalid Google App Password or TLS handshake failure
Let’s fix these one by one.
Solution 1: Fix through WHM or cPanel Settings
If your site is hosted on a cPanel server, check this setting first. Steps:
1) Log in to WHM (Web Host Manager) as root.
2) Navigate to: Home → Server Configuration → Tweak Settings
3) Find this option: Restrict outgoing SMTP to root, exim, and mailman.
4) Turn this OFF.
5) Save the settings and restart the mail service. it often solves the issue instantly.
At CloudCareHost, we’ve fixed dozens of WordPress email issues just by disabling this SMTP restriction. It allows your website (and WP Mail SMTP plugin) to communicate freely with external mail servers like Gmail or Outlook.
Solution 2: Whitelist SMTP Ports in Firewall
If your server isn’t cPanel-based or uses a custom VPS firewall, the issue might be blocked ports.
Steps:
1) Log in to your server via SSH or open your Firewall Manager.
2) Whitelist the following ports:
• Port 465 → SSL- • Port 587 → TLS
3) Save changes and restart your firewall service.
4) Run a test email via: WP Mail SMTP → Tools → Email Test
Once the ports are open, your WordPress can securely connect to the SMTP host.
Solution 3: Use a Google App Password for Gmail SMTP
If you’re using Gmail SMTP, your normal password won’t work because of Google’s advanced security. Instead, use an App Password.
Steps:
1) Go to your Google Account → Security → 2-Step Verification and turn it ON.
2) After enabling, click App Passwords.
3) Choose:-
• App: Mail - • Device: Other (Custom name)
-
4) Generate the password and copy it.
5) In WP Mail SMTP → Settings → SMTP Password, paste the generated app password.
6) Save changes.
This method is 100% secure and ensures your WordPress site can send emails reliably.
At CloudCareHost, we always recommend App Passwords for Gmail users; it’s safer and fully supported by Google.
Solution 4: Check SSL Certificate and DNS Configuration
Still seeing the SSL mismatch warning like CN=mail.domainname? That’s a certificate or DNS issue.
Verify These:
- • Your domain’s A record points to the correct server IP.
• Your SSL certificate is valid, active, and installed properly.
• If you’re on a shared server, confirm that your SMTP hostname (e.g., server.cloudcarehost.com) has a matching SSL certificate.
Pro Tip: Try disabling Auto TLS under WP Mail SMTP → Settings temporarily to identify if SSL negotiation is the cause.
Bonus Tip: Use a Dedicated SMTP Relay Service
If you face repeated delivery or connection errors, using a dedicated SMTP relay service can help.
Top reliable options:
• SendGrid
• Mailgun
• Amazon SES
• Brevo (Sendinblue)
At CloudCareHost, our hosting servers are SMTP-optimized and preconfigured to work seamlessly with these providers. This guarantees faster and more secure email delivery, no connection issues, ever.
Common Mistakes to Avoid
• Using your cPanel email with Gmail SMTP hostname- • Incorrect port configuration (465 vs 587)
- • Expired SSL or self-signed certificates
- • Plugins overriding your SMTP settings
Always double-check these before testing your connection.
How to Test Your SMTP Connection
After applying all fixes:
• Go to WP Mail SMTP → Tools → Email Test - • Send a test email to your admin address
- • If successful, you’re done!
- • If not, recheck the hostname, port, and password fields.
Final Thoughts
The “Could Not Connect to SMTP Host” error in WordPress may seem complicated, but once you understand the cause, it’s simple to fix:
• Using WHM? → Disable SMTP restrictions in Tweak Settings - • Firewall issue? → Whitelist SMTP ports 465 and 587
- • Using Gmail SMTP? → Use App Password instead of a normal password
- • SSL mismatch? → Reinstall the correct certificate
With these steps, and hosting support from CloudCareHost.com, your WordPress email delivery will run flawlessly.
Frequently Asked Questions (FAQ)
Q1. Why am I getting “Could not connect to SMTP host” in WP Mail SMTP?
→ This usually happens because of SSL mismatches, blocked ports, or incorrect Gmail SMTP credentials.
Q2. What ports should I open for SMTP in WordPress?
→ Use 465 (SSL) and 587 (TLS). Both should be allowed in your server firewall.
Q3. Is WP Mail SMTP plugin safe?
→ Yes, WP Mail SMTP is trusted by millions of WordPress users. Always use secure SMTP credentials or Google App Passwords.
Q4. Can CloudCareHost fix this issue for me?
→ Absolutely. Our technical team at CloudCareHost.com can configure your SMTP, fix SSL, and optimize your WordPress mail delivery system.
Recommended Read: How to Fix High Bandwidth and Resource Usage in CyberPanel
Categories:
Wordpress
5 min read
Was this article helpful?