Fix Microsoft 365 SMTP Email Delivery from PHP
Question details
A user needs to restore email delivery from a PHP application using Microsoft 365 SMTP.

- Product
- Microsoft 365 Exchange Online SMTP
- Device & OS
- not provided
- Scenario
- A PHP application sends email through smtp.office365.com.
- Observed behavior
- The application may generate a Message-ID, but email is not delivered.
Identify the Microsoft 365 mailbox used by the PHP application and locate its SMTP settings and error logs. Make sure you can access the Microsoft 365 admin center or ask an administrator to check the mailbox and message trace.
Verify Microsoft 365 SMTP submission settings
Use this solution to check the server, encryption, authentication, and mailbox permissions used by the PHP application.
Open the application's mail configuration and set the SMTP host to smtp.office365.com, the port to 587, and encryption to STARTTLS.
Check the SMTP authentication settings in your PHP mail library. Use a supported authentication method, such as OAuth, and verify that the application has the required Microsoft 365 permissions.
In the Microsoft 365 admin center, open Users > Active users, select the mailbox, and check Mail > Manage email apps for Authenticated SMTP. Also ask an administrator to check organization-wide SMTP AUTH settings and authentication policies.
Compare the From address in the PHP application with the authenticated mailbox. If they differ, verify that the account has permission to send as the selected address.
Check the mailbox and PHP application errors
Use this solution to identify account access problems or errors returned by the mail library.
Test port 587 and trace the message
Use this solution to distinguish a network connection problem from a message processing or delivery problem.
Use WPS Office for Everyday Office Files
WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility for easier migration. It does not resolve Microsoft 365 SMTP server or PHP email delivery issues.

Frequently Asked Questions
Does a Message-ID mean Microsoft 365 delivered the email?
No. A PHP application can generate a Message-ID before the message is accepted. Check the SMTP response and search Mail flow > Message trace in the Exchange admin center.
Which SMTP settings should my PHP application use?
For Microsoft 365 client SMTP submission, configure smtp.office365.com on port 587 with STARTTLS and a supported authentication method.
Where can I check whether SMTP AUTH is enabled for a mailbox?
In the Microsoft 365 admin center, go to Users > Active users, select the mailbox, and check Mail > Manage email apps for Authenticated SMTP. Organization settings and authentication policies can also affect access.
What should I do if the PHP server cannot connect on port 587?
Check outbound firewall rules on the application server and network, then contact your hosting provider or internet provider to determine whether port 587 is blocked.
Why can the mailbox sign in but the application still fail to send?
Web sign-in does not confirm that SMTP AUTH is available or that the PHP application has valid authentication and sender permissions. Check the mail library's SMTP error output and the mailbox's email app settings.




