How to Fix PHPMailer Error 530 5.7.57 with Microsoft 365 SMTP
Question details
The user needs to resolve an issue where Microsoft 365 rejects email sending attempts from PHPMailer or Drupal 9, returning an authentication error.

- Product
- Microsoft 365 SMTP
- Device & OS
- not provided
- Scenario
- Configuring a line-of-business application or website to send automated emails using Microsoft 365 SMTP servers.
- Observed behavior
- The application successfully connects to smtp.office365.com and completes STARTTLS, but Microsoft 365 rejects the MAIL FROM command with error 530 5.7.57 (Client not authenticated to send mail).
Ensure you have administrative access to the Microsoft 365 admin center and possess the exact email address and password for the mailbox you are attempting to authenticate.
Enable Authenticated SMTP and Verify Configuration
Check your Microsoft 365 mailbox settings to ensure SMTP authentication is permitted and verify the application's connection settings.
Microsoft 365 disables Basic Authentication (SMTP AUTH) for many tenants by default to improve security. To allow an application like Drupal 9 to send emails, you must explicitly enable SMTP AUTH for the specific sending mailbox and ensure your PHPMailer settings perfectly match Microsoft's requirements.
Sign in to the Microsoft 365 admin center. Navigate to Users > Active users, select the user account you are using to send emails, click the Mail tab, and select Manage email apps. Ensure the 'Authenticated SMTP' box is checked and save changes.
In your Drupal 9 or PHPMailer configuration interface, set the SMTP server host strictly to smtp.office365.com and the port to 587.
Ensure the connection security protocol is set to STARTTLS (sometimes labeled as TLS in older interfaces). Do not use SSL/TLS on port 465, as Microsoft 365 does not support it for SMTP client submission.
Provide the full email address (e.g., sender@yourdomain.com) as the username and the correct account password. Verify that the 'From' address in your application matches this authenticated email address.

Need a simpler office suite? Try WPS Office
While managing complex Microsoft 365 backend configurations like SMTP routing and tenant authentication policies, you might find that your everyday document tasks require a less complicated solution. WPS Office is a lightweight, completely free alternative that seamlessly handles all your Word, Excel, and PowerPoint files without the enterprise administration overhead.
- 1. Visit the WPS Office Website: Go to the official WPS website to access the latest free version of the office suite.
- 2. Download the Installer: Click the Free Download button to get the installer for your specific operating system.
- 3. Install and Start Working: Run the setup file and open WPS Office to immediately start viewing and editing your Microsoft Office documents.

Frequently Asked Questions
What does Error 530 5.7.57 mean in Microsoft 365?
This error, 'Client not authenticated to send mail,' means your application is trying to send an email via the Microsoft 365 SMTP server without successfully logging in first. It often happens if SMTP AUTH is disabled for the mailbox or if the credentials provided by the application are incorrect.
Can I use port 25 for Microsoft 365 SMTP instead of 587?
Port 25 is typically used for Microsoft 365 Direct Send or SMTP Relay, which requires configuring a connector in the Exchange admin center and whitelisting your server's static IP address. For standard client SMTP authentication using PHPMailer, you must use port 587 with STARTTLS.
Why is my SMTP authentication failing even with the correct password?
Microsoft 365 blocks legacy basic authentication by default to protect accounts. If the password is correct but it still fails, the account likely has Multi-Factor Authentication (MFA) enforced, Conditional Access policies blocking legacy protocols, or global Security Defaults turned on.




