WordPress / PHPMailer: SMTP Error: Could not authenticate / SMTP connect() failed
The SMTP server rejected the login or couldn’t be reached — wrong credentials, app passwords required, wrong port/encryption, or outbound SMTP blocked.
Seen on:
WordPress
Meaning
Gmail/Microsoft 365 require app passwords or OAuth; basic auth may be disabled. Hosts often block ports 25/465/587 outbound. Port and encryption must match (587+TLS, 465+SSL).
Common causes
- Wrong username/password or app password needed
- Provider disabled basic SMTP auth (Microsoft 365)
- Port/encryption mismatch
- Outbound SMTP ports blocked by host
⚡ Quick fix
- Use an app password or the provider’s OAuth/API mailer
- Match port and encryption (587 STARTTLS / 465 SSL)
- Test connectivity from the server
Detailed fix by platform
Shell
- php
openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf </dev/null | head -5 nc -vz smtp.example.com 587
How to diagnose
- Credentials — App password?
- Network — Port reachable?
- Settings — Port/encryption pair
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 403 Forbidden wp-admin WordPress: 403 Forbidden on wp-admin, wp-login.php or admin-ajax.php
- 404 except homepage WordPress: 404 Not Found on every page except the homepage (permalinks / .htaccess / Nginx rules)
- 550 5.1.1 550 5.1.1 The email account that you tried to reach does not exist (User unknown)
Most viewed in WordPress
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026