If WordPress shows you an SMTP connect() failederror when it tries to send mail, this is the message on screen:
SMTP Error: Could not connect to SMTP host.
SMTP connect() failed.It means WordPress never reached the mail server at all. Authentication was never attempted — the connection itself was not established. That is good news, because the number of possible causes is small and the diagnosis is quick.
Try this first
In most cases the cause is a single mismatch: the port and the encryption type do not belong together.
Open your SMTP settings and make sure you are using one of these two combinations:
| Port | Encryption |
|---|---|
| 587 | STARTTLS |
| 465 | SSL/TLS |
If 587 is paired with SSL/TLS, or 465 with STARTTLS, the connection cannot be established. Select the correct pairing, save, and send a test.
If that does not fix it, read on.
What SMTP connect() failed actually means
WordPress uses the PHPMailer library to send email. When SMTP is configured, PHPMailer first opens a TCP connection to the mail server. If that step fails, you get the SMTP connect() failed error.
The failure usually takes one of two shapes, and the two have different causes.
Connection refused.The other end is actively rejecting the connection. Usually nothing is listening on that port, or a firewall is closing it immediately. The error comes back fast.
Connection timed out.The other end never answers. Usually outbound traffic is being blocked and the packets are dropped silently. The error comes back after roughly thirty seconds.
How long the error takes to appear is itself diagnostic: instant means refused, delayed means blocked.
Cause 1: port and encryption do not match
This is the most common cause and the easiest to fix.
Port 587 opens as a plain connection and then upgrades to encryption with the STARTTLS command. Port 465 is encrypted from the first byte of the connection.
Here is what happens when the two are confused: connect to 465 with STARTTLS and the server expects encrypted data while you send plaintext, so the connection drops. Do the reverse and the server expects a plain connection while you begin a TLS handshake, and it drops again.
Use the pairing your provider documents. If both are supported, 587 with STARTTLS is the more common choice.
Cause 2: your host blocks the outbound port
Shared hosting providers restrict outbound SMTP traffic. Port 25 is almost always closed; some providers close 587 and 465 as well.
In that case the SMTP connect() failed error arrives as a timeout, because the packets never reach their destination.
Work through these in order:
If 587 does not work, try 465. Some providers leave one open and the other closed.
If neither works, try port 2525. Some transactional email providers offer it as an alternative, and hosting companies rarely block it.
If none of them work, write to your provider. The question is specific: “are outbound ports 587 and 465 open from this server, and if not, can you open them?”
If the provider will not open them, the remaining route is a transactional email service that sends over an API rather than SMTP. Those services work over port 443, which is never blocked.
Cause 3: the host name is wrong
Less common, but easy to overlook.
A typo.A missing letter, as in smtp.gmai.com, makes DNS resolution fail and the connection is never attempted.
The wrong server.An incoming mail server — one beginning with imap.or pop.— cannot be used for SMTP. Sending requires the address that begins with smtp..
On shared hosting, DNS has not propagated yet.If you are using the mail.yourdomain.compattern and the domain was recently moved, the record may not exist yet.
Testing the connection from the server
If you have SSH access, one command tells you whether the problem is in WordPress or on the server.
For 587:
openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlfFor 465:
openssl s_client -connect smtp.gmail.com:465 -crlfReplace the host name with your own value.
| Output | What it means |
|---|---|
A greeting line beginning with 220 | The connection works; the problem is in your WordPress settings |
Connection refused | Nothing is listening on that port; the host name or port is wrong |
A long wait, then Connection timed out | The outbound port is blocked; ask your provider |
Lines beginning with verify error | A certificate problem; the connection may still have been established |
Type QUITand press Enter to exit.
If you do not have SSH access, your hosting provider’s support team can run this test for you.
Verifying SMTP connect() failed is gone
If you believe you have fixed the error, run all three checks.
| Check | Expected |
|---|---|
| The plugin’s test email | Sends without an error |
| A real event, such as a form submission | Arrives in the inbox |
| Enter a wrong port on purpose and test again | The error must come back |
The third check proves the connection is genuinely being made. If the test still reports success with a wrong port, the plugin is not using SMTP at all — it is falling back to the old delivery path. Restore the correct port afterwards.
How AIOWS helps:
AIOWS SMTP Manager
AIOWS SMTP Manager ships host and port values for common providers. Gmail, Outlook and Office 365, Yahoo and Zoho, along with transactional services such as SendGrid, Mailgun, Amazon SES, Brevo, SparkPost and Postmark, are selected from a list, and the port arrives already paired with the right encryption — so the first cause in this article never occurs. If you use your hosting provider’s own server, the custom SMTP option takes the values by hand.
Its connection test shows the conversation with the server step by step, so you can read which stage the connection broke at. It gives you from the dashboard what the openssltest above gives you, without needing SSH access.
For Gmail and Microsoft 365, EasyConnect takes a different route. A normal OAuth setup means creating a project in the Google Cloud Console, configuring the consent screen, generating credentials and defining a redirect URI. With EasyConnect you press “connect with Google”, the authorisation screen opens, you grant permission, and the connection is made. There is no console step. The same authorisation also applies in Backup Manager; an account you connect once works in both modules.
Its limits, stated plainly:the module cannot open a port your hosting provider has closed. If SMTP connect() failed is caused by a blocked port, the fix is with your provider — the module will show you that the problem is there, but it cannot resolve it. It also cannot change firewall rules on the server, or write your domain’s SPF or DKIM records into DNS for you.
FAQ
Does SMTP connect() failed mean my password is wrong?
No. The error means the connection could not be made, so authentication was never reached. A password failure arrives separately, with code 535.
The same settings work on another site but not here. Why?
If the two sites are on different servers, one may allow outbound SMTP while the other blocks it. The server-side connection test settles this.
The error appears sometimes but not always. Is that normal?
No. An intermittent failure usually indicates rate limiting or a transient network problem. If you are sending many messages in a short period, your provider may be refusing connections temporarily.
Can I disable certificate verification?
Do not. It does not make the connection unencrypted, but it does leave it open to interception. If you are seeing certificate errors, the real problem is the port and encryption pairing or the host name.
Is port 2525 secure?
The port number does not determine security; the encryption does. Over 2525 with STARTTLS, the connection is as secure as it is over 587.









