Set the mail environment variables

Deliver application mail with Laravel’s SMTP transport. Use the SMTP mailer in the application environment and keep credentials in secret storage outside source control.

Test synchronous and queued mail

Start with a synchronous Mailable in a non-production environment, then test the real queued path. Check failed_jobs and worker logs for application errors, while using the per-client delivery counter to distinguish jobs that never ran from mail accepted by the bridge.

Set Laravel’s mail transport correctly

Set MAIL_MAILER=smtp, MAIL_HOST to the displayed hostname, MAIL_PORT=587, MAIL_ENCRYPTION=tls, and the generated username and password. Set MAIL_FROM_ADDRESS to the connected mailbox.

Run php artisan config:clear after changing environment values. Production workers cache configuration, so restart queue workers before testing a queued Mailable. Keep .env and deployment secrets out of source control.

Before you save

Use the connected Microsoft 365 address as the sender. Store the generated password securely; it cannot be displayed again.

Send a small test message to an address you control. Confirm delivery before enabling production notifications.

If the test fails

Check that port 587 is permitted by the network, STARTTLS is enabled, and no spaces were copied into the credentials.

Never share passwords or message content. Revoke and recreate the connection if the password is lost.