Laravel cannot send mail through Office 365 / Microsoft 365 SMTP
Unable to send SMTP mails using office365 settingsShort answer
Four things block Office 365 SMTP from Laravel. SMTP AUTH is off for the mailbox or tenant, basic authentication is blocked by security defaults or policy, the port or TLS settings are wrong, or the From address is not the signed-in mailbox. Check the server reply first; it names which one.
Fix it fast
1Find out which cause you have
Reproduce the failure outside Laravel, so you see the server's own reply. Open a STARTTLS session to the Microsoft server on port 587 and try to authenticate.
openssl s_client -starttls smtp -connect smtp.office365.com:587 -crlf2Match what you see, then jump to its fix
- 1
Authentication is rejected although the password is rightSMTP AUTH is disabled for the tenant or the mailboxFix - 2
Login fails with a correct password, and SMTP AUTH is enabledBasic authentication is blocked or being retiredFix - 3
Connection times out, or the handshake fails before loginWrong host, port or TLS settingFix - 4
5.7.60 SMTP; Client doesn't have permissions to send as this sender.The From address is not the mailbox that signs inFix
- 1
What does the error look like?
Unable to send SMTP mails using office365 settings5.7.60 SMTP; Client doesn't have permissions to send as this sender.
Cause 1 of 4
SMTP AUTH is disabled for the tenant or the mailbox
1Check
SMTP AUTH is disabled by default for organizations created after January 2020. A per-mailbox setting overrides the organization one. Read both values in Exchange Online PowerShell.
Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled
Get-CASMailbox -Identity sender@example.com | Format-List SmtpClientAuthenticationDisabled2Fix
Enable SMTP AUTH for that mailbox only. In the Microsoft 365 admin center the same switch is Mail > Manage email apps > Authenticated SMTP.
Set-CASMailbox -Identity sender@example.com -SmtpClientAuthenticationDisabled $false3Verify
The property reads False for the mailbox, then send a test message from Laravel.
Get-CASMailbox -Identity sender@example.com | Format-List SmtpClientAuthenticationDisabledConfirmed by learn.microsoft.com
Cause 2 of 4
Basic authentication is blocked or being retired
1Check
SMTP AUTH is already disabled when security defaults are on, and an authentication policy that disables basic authentication for SMTP blocks it even if the settings above are on. Microsoft also schedules basic authentication for client SMTP submission for deprecation.
# ask the tenant administrator whether security defaults or an authentication policy blocks basic authentication for SMTP2Fix
Use OAuth (modern authentication) for the SMTP connection. For internal recipients only, Microsoft points to High Volume Email, and for internal and external mail to Azure Communication Services Email. Basic authentication stays an option only where the policy allows it.
# no Laravel code change fixes this: choose OAuth, HVE or Azure Communication Services as the sending route3Verify
Send a test message after the new route is set up.
php artisan tinkerConfirmed by learn.microsoft.com
Cause 3 of 4
Wrong host, port or TLS setting
1Check
Client SMTP submission uses the DNS name smtp.office365.com on port 587 (25 also works) with STARTTLS and TLS 1.2 or 1.3. Port 465 is not supported, and a firewall or ISP may block port 25.
nc -vz smtp.office365.com 5872Fix
Set the host to smtp.office365.com, the port to 587 and TLS/STARTTLS on in your mail settings. Do not use an IP address.
# mail settings: host smtp.office365.com, port 587, STARTTLS enabled3Verify
The connection test shows the port open, then Laravel sends.
nc -vz smtp.office365.com 587Confirmed by learn.microsoft.com
Cause 4 of 4
The From address is not the mailbox that signs in
1Check
The address of the signed-in mailbox appears as the sender. If your app sends from a different address, the signed-in account needs Send As permission on that mailbox.
grep -rn "MAIL_FROM_ADDRESS" .env config/mail.php2Fix
Either set the global from address to the authenticated mailbox, or have an administrator give the signed-in account Send As permission on the other mailbox.
// config/mail.php
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'sender@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],3Verify
Send a test message and confirm no bounce arrives.
php artisan config:clearConfirmed by learn.microsoft.com
How do I stop it coming back?
- Plan for OAuth or an API-based sender now, because basic authentication for client SMTP is scheduled for retirement.
- Enable SMTP AUTH per mailbox, not for the whole organization.
- Keep one sending address that matches the signed-in mailbox.
- Stay under the client submission limits: 30 messages per minute and 10,000 recipients per day.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix