Exchange Connection Problems

Fix Office 365 SMTP Connection Refused on Port 587 in WordPress

Maira MehtabMaira Mehtab Nov 25, 2026 868 views

Question details

The user needs to connect a WordPress site to Office 365 SMTP through the WP Mail SMTP plugin.

Fix Office 365 SMTP Connection Refused on Port 587 in WordPress
Product
Microsoft 365 Exchange Online SMTP and WP Mail SMTP
Device & OS
not provided
Scenario
A WordPress site is configured to send mail through smtp.office365.com on port 587.
Observed behavior
The plugin reports a connection-refused error, and the hosting provider suspects IPv6 or suggests using a direct IP address.
Before you start

Have your WP Mail SMTP settings and hosting provider details available. If you have server shell access, check whether tools such as nslookup, nc, or OpenSSL are installed.

Solution 1Recommended

Check outbound port 587 and Office 365 SMTP settings

Use these checks to identify whether the refusal comes from the network path or an incorrect SMTP configuration.

1
Verify the SMTP settings

In WordPress, open WP Mail SMTP > Settings and review the selected mailer's settings. For a manual SMTP configuration, use smtp.office365.com, port 587, and TLS/STARTTLS rather than implicit SSL.

2
Check DNS resolution

From the hosting server's shell, run nslookup smtp.office365.com to check that the hostname resolves. An IPv4-only server can connect to Office 365; IPv6 support is not required.

3
Test outbound connectivity

From the hosting server, run nc -vz smtp.office365.com 587 if nc is available. If the connection is refused or times out, ask the hosting provider to check outbound SMTP restrictions, firewall rules, and the network path.

4
Test STARTTLS

If port 587 is reachable, run openssl s_client -starttls smtp -connect smtp.office365.com:587 from the server. Review any TLS errors and ask the hosting provider to check the server's TLS configuration if the handshake fails.

5
Send a test email

In WordPress, open WP Mail SMTP > Tools > Email Test and send a test message. If the connection succeeds but authentication fails, review the plugin's Microsoft 365 mailer setup and the Exchange Online SMTP authentication policy for the mailbox.

Check outbound port 587 and Office 365 SMTP settings
Connection versus authentication: A connection-refused error occurs before SMTP authentication. Resolve network reachability first, then investigate credentials or authentication policy if a later test reports an authentication error.
Free Microsoft Office alternative

Document SMTP Troubleshooting in WPS Office

WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and support for common Office formats, making it easy to move troubleshooting notes and reports between suites. It does not fix Exchange Online SMTP connectivity.

Record port 587 tests and hosting-provider responses in WPS Writer.Open and edit Microsoft Word DOCX and Excel XLSX files.Use a familiar interface for a straightforward move from Microsoft Office.Work with documents in a lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Does Office 365 SMTP require IPv6?

No. Office 365 supports IPv4 and IPv6, so an IPv4-only server can connect. Check DNS resolution and outbound access to smtp.office365.com on port 587.

Should I use a Microsoft IP address instead of smtp.office365.com?

Keep smtp.office365.com in the SMTP host field. Microsoft service IP addresses can change; consult the current Office 365 URLs and IP address ranges documentation for network rules.

Which encryption setting should I use for port 587?

In the manual SMTP settings under WP Mail SMTP > Settings, select TLS/STARTTLS for port 587 rather than implicit SSL.

What if port 587 works but the test email still fails?

Check the error shown under WP Mail SMTP > Tools > Email Test. For an authentication error, review the mailer's setup and the Exchange Online SMTP authentication policy for the mailbox.