These errors mean WordPress couldn’t reach your SMTP server. The most common causes are a hosting firewall blocking ports 587/465, a wrong host/port/encryption combo (TLS vs SSL), or Cloudflare/DNS pointing SMTP to the wrong place. Below is a fast path, then bulletproof steps with logs to prove the exact cause.
WP Mail SMTP shows “SMTP connect() failed” / “Could not connect to SMTP host.” Can you give me the fastest fix and then the full, safe steps?
Updated November 2025
TL;DR: This is a connection failure (not authentication).
smtp.gmail.com, smtp.sendgrid.net). Provider settings checklistIf the quick path didn’t resolve it, click Continue Chat below and I’ll run an automatic environment check with you (ports, DNS, encryption), then proceed with the steps.
SMTP connect() failed / Could not connect to SMTP host means WordPress could not open a TCP connection to your SMTP server. Common reasons: blocked outgoing ports, wrong host/port/encryption pairing, or DNS/proxy issues. Authentication errors are different (they happen after connecting). See WP Mail SMTP’s explanation and Debug Events.
| Symptom (Debug Events) | Likely cause | First check |
|---|---|---|
| “Connection timed out (110)” | Host/WAF blocking outbound SMTP | Ask host to allow 587/465 to your SMTP host; retest Email Test |
| “Connection refused (111)” | Port closed/denied on remote host | Try the provider’s supported port/encryption; confirm host name |
| getaddrinfo / DNS failed | Wrong hostname or proxied DNS (Cloudflare) | Use provider’s exact SMTP hostname; mark DNS as DNS‑only |
| TLS handshake/SSL error | Wrong encryption or CA trust issue | Switch 587↔465 with TLS/SSL as required; host updates CA bundle |
587/465 to your SMTP provider. Many shared hosts block external SMTP; use their relay or an API mailer if needed. BackgroundUsing Gmail/Microsoft/SendGrid via API avoids outbound SMTP and often improves deliverability. Docs: Gmail mailer, Microsoft 365 / Outlook mailer.
Enable WordPress logging while testing (no front‑end display):
/* wp-config.php */
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Reproduce a test send; check wp-content/debug.log. Docs: Debugging in WordPress. Turn logging off when done.
587 or 465—which should I use?
Start with 587 + TLS. Use 465 + SSL only if your provider requires it. See WP Mail SMTP’s guide.
My host blocks outbound SMTP. What now?
Request an allow‑list for your SMTP host/ports or use your host’s relay. If not possible, switch to an API mailer (Gmail/Microsoft/SendGrid). Why hosts block SMTP · Gmail · Microsoft
The log mentions authentication—does this page still apply?
“Could not connect” fails before login; “Could not authenticate” means credentials were rejected after connecting. Use Debug Events to confirm which case you’re in and follow the relevant guide. Explanation · Debug Events
Still stuck? Click Continue Chat below and I’ll walk you through your Debug Events, host port checks, and the fastest working mailer for your setup.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!