Send & Receive Issues

How to Fix PHP Form Emails Not Sending to Microsoft 365 Shared Mailboxes

Amos GikundaAmos Gikunda Nov 3, 2026 868 views

Question details

The user needs to restore email delivery for a website PHP contact form that stopped working after migrating the domain to Microsoft 365.

How to Send Website PHP Form Emails Through Microsoft 365 SMTP Relay
Product
Microsoft 365
Device & OS
not provided
Scenario
A website's domain was recently moved to Microsoft 365, and the webmaster needs the site's PHP form to send notifications to a shared mailbox that does not have a dedicated password.
Observed behavior
The PHP contact form fails to send or deliver emails to the designated shared mailbox after the domain migration to Microsoft 365.
Before you start

Ensure you have global administrator access to the Microsoft 365 Admin Center and know the static IP address of your web hosting server where the PHP form is hosted.

Solution 1Recommended

Configure a Microsoft 365 SMTP Relay Connector

Set up an SMTP relay using an Exchange connector to authenticate your web server's IP address. This allows your PHP application to send emails securely to a shared mailbox without requiring a user password.

Microsoft 365 enforces strict sender authentication. When moving a domain, external web servers attempting to send mail on behalf of your domain are blocked by default to prevent spoofing. By creating an inbound connector linked to your web server's static IP address, you whitelist the server. This method is highly recommended for shared mailboxes because it relies on IP authentication rather than a standard username and password.

1
Access the Exchange Admin Center

Log in to the Microsoft 365 Admin Center with your administrator credentials. In the left navigation pane, click on 'Show all', then select 'Exchange' to open the Exchange Admin Center.

2
Create a New Mail Flow Connector

Navigate to 'Mail flow' and then 'Connectors'. Click the '+ Add a connector' button. Choose 'Your organization's email server' as the sending source and 'Office 365' as the destination.

3
Authenticate the Web Server IP

Name the connector (e.g., 'Website PHP Form Relay'). Under the authentication step, choose the option to verify the sender by verifying that the sending server IP address matches the ones you specify. Enter the static IP address of your web server.

4
Update Your Domain's SPF Record

Access your domain's DNS settings. Modify your existing SPF record to include the web server's IP address (e.g., v=spf1 ip4:YOUR_SERVER_IP include:spf.protection.outlook.com -all). This prevents the routed emails from being flagged as spam.

5
Configure the PHP Mailer Settings

Update your PHP form's SMTP configuration to point to your domain's MX endpoint (e.g., yourdomain-com.mail.protection.outlook.com). Set the SMTP port to 25 and disable SMTP authentication in the PHP script, as the IP connector handles the authentication.

Configure a Microsoft 365 SMTP Relay Connector
Shared Mailbox Delivery: Once the connector is active and DNS changes propagate, your PHP form will successfully route emails to your shared mailbox, bypassing the need for a standalone mailbox password.
Free Microsoft Office alternative

Manage Your Website Form Data Easily with WPS Office

While Microsoft 365 handles your domain's SMTP email routing, you can rely on WPS Office to compile, analyze, and report on the customer data collected from your website's PHP contact forms. WPS Office is a lightweight, completely compatible alternative to Microsoft Office that is free to use.

  1. 1. Download the Application: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install and Setup: Run the installer and follow the quick on-screen instructions to set up the suite on your device.
  3. 3. Open Your Form Data: Launch WPS Spreadsheets to seamlessly open and manage your PHP form's CSV or Excel data exports.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formatsEasily open, clean, and analyze CSV data exports generated by your website's PHP formsLightweight application that uses minimal system resources while offering powerful featuresFree to use with a familiar, easy-to-navigate tabbed interface for seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

Why did my PHP contact form stop working after moving to Microsoft 365?

When you migrate to Microsoft 365 and change your MX records, Microsoft's security protocols take over. If your web server tries to send emails using your domain name without being explicitly authorized via an SMTP connector or an updated SPF record, Microsoft 365 will reject the messages to prevent email spoofing.

Do I need a paid user license to receive PHP form emails via SMTP relay?

No. By configuring a Microsoft 365 SMTP relay connector, you can route inbound website emails directly to a shared mailbox. Shared mailboxes do not require a separate paid Microsoft 365 user license or a dedicated password.

What port should my PHP script use for Microsoft 365 SMTP relay?

When using the Microsoft 365 SMTP relay method with an IP-based connector, you should configure your PHP mailer script to connect over port 25. Ensure that your web hosting provider does not block outbound traffic on port 25.

Can I use SMTP Client Submission instead of an SMTP Relay connector?

You can use SMTP Client Submission (port 587), but this method requires a fully licensed Microsoft 365 mailbox with a dedicated username and password. It cannot be used to authenticate directly against an unpassworded shared mailbox.