Send & Receive Issues

Fix Magento 2 SMTP Email Exception with Microsoft 365

Olivia MillerOlivia Miller Oct 26, 2026 868 views

Question details

Users experience a Laminas Mail SMTP RuntimeException in Magento 2 when attempting to send emails using Microsoft 365 or Outlook SMTP servers.

Fix Magento 2 SMTP Email Exception When Sending Messages via Microsoft 365
Product
Magento 2 / Microsoft 365
Device & OS
not provided
Scenario
Configuring a Magento 2 store to send transactional emails via Microsoft 365 or Outlook SMTP credentials.
Observed behavior
The system throws a Laminas Mail SMTP RuntimeException and fails to send the messages due to missing or mismatching sender addresses.
Before you start

Ensure you have administrator access to your Magento 2 backend and verify that you have the exact login credentials for the Microsoft 365 or Outlook account being used for SMTP.

Solution 1Recommended

Match the 'From' Email Address with the SMTP Authentication Email

Resolve the Laminas Mail SMTP RuntimeException by ensuring the sender address in Magento exactly matches the authenticated Microsoft 365 account.

Microsoft 365 and Outlook SMTP servers enforce strict anti-spoofing policies. If the 'From' address on your outgoing email does not match the email address used to log into the SMTP server, the connection is rejected.

1
Access Store Email Addresses

Log into your Magento 2 admin panel, navigate to 'Stores' > 'Settings' > 'Configuration', and expand the 'General' tab to select 'Store Email Addresses'.

2
Update the Sender Email

Set the 'Sender Email' field (for General Contact, Sales Representative, etc.) to the exact Microsoft 365 email address you use for your SMTP authentication.

3
Verify SMTP Configuration

Go to 'Advanced' > 'System' (or navigate to your specific third-party SMTP module settings) and ensure 'SMTP Authentication' is enabled. Confirm the username is identical to the 'Sender Email' and the password is correct.

4
Save and Test

Click the 'Save Config' button, flush your Magento cache under 'System' > 'Cache Management', and send a test email to verify the exception is resolved.

Match the 'From' Email Address with the SMTP Authentication Email
Microsoft 365 Policies: Microsoft 365 strictly prohibits sending emails from an address that differs from the authenticated user. Ensure all transactional emails use the authenticated address to prevent server rejections.
Free Microsoft Office alternative

Manage Your E-commerce Data with WPS Office

While troubleshooting backend server configurations like Magento SMTP requires specialized web tools, analyzing your e-commerce exports and sales reports is much easier with a reliable productivity suite. WPS Office is a free, lightweight, and highly compatible alternative to Microsoft Office, perfect for managing your business data.

Fully compatible with Microsoft Excel (.xlsx) formats for seamless Magento data export analysis.Lightweight design ensures fast performance even with large e-commerce inventory spreadsheets.Includes Writer, Presentation, and Spreadsheet tools in one unified, intuitive application.Cost-effective solution to manage your retail business without expensive subscription fees.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Microsoft 365 reject my Magento 2 emails?

Microsoft 365 requires the 'From' address of the email to exactly match the email address used to authenticate the SMTP connection. If they mismatch, the server rejects the message to prevent email spoofing, throwing an SMTP exception.

What is a Laminas Mail SMTP RuntimeException?

This is an error thrown by the Laminas Mail framework, which is used by Magento 2.4 and newer versions. It occurs when the SMTP server refuses to process an outgoing email, most often due to authentication failures or missing sender headers.

How do I test my SMTP settings in Magento 2?

Most Magento 2 installations utilizing a third-party SMTP module include a 'Test Email' feature within the module's configuration settings. Enter a recipient email address and click the test button after updating your credentials to confirm the SMTP connection is successful.