Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Symfony Mailer Office365

148 sites No security coverage
View on drupal.org

This module provides integration for sending emails through Office365 using OAuth authentication. It allows Drupal sites to continue sending emails via Office365 after basic authentication via SMTP is deprecated. The module handles OAuth token refreshing automatically via Drupal cron or a Drush command.

Symfony Mailer Office365 Integration

Why?

Office365 stops support for sending via SMTP with Basic Auth information (Username & Password).

A modern OAuth Flow is required. Since there is no feasable Drupal solution as of writing, this module provides a gap until there is an implementation provided by Symfony itself or a different solution.

How-To

1. Register your app with Microsoft Entra and provide Redirect URL: `https://example.com/office365/oauth/callback`
2. Configure with given credentials
`admin/config/system/mailer/office365`
3. Add "Office 365 - OAuth" Transport to your mailing policy
4. Login to save OAuth State with Drupal (Link available here: `admin/config/system/mailer/office365`)

Refreshing the token state

Using OAuth requires you to keep refreshing the access token with the given refresh token once it expired.
This module provides two ways to do that.

a) Drupal Cron

Refreshing (if necessary) happens when the Drupal Cron is run.
In that case make sure it gets run at least every 12 hours to be on the safe side.

See Token Lifetime: https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens...

b) Drush Command

If you want to refresh the token (if necessary) in an own interval separate to the cron you can run the following drush command:

drush office365:refresh

Please choose an appropriate interval for this method as well.

Troubleshooting

You should check the status page `admin/config/system/mailer/office365` and check the system logs (watchdog f.e) for any error messages.

Credits

This was insipired by the following gists

Even though a lot has been rewritten, this inspired a lot how this concept was implemented. Thanks!

Please also see https://github.com/symfony/symfony/pull/52585 for development with symfony, which would make this module probably obsolete.

Activity

Total releases
5
First release
Apr 2025
Latest release
1 week ago
Releases (12 mo)
2 ▼ from 3
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0-alpha5 Pre-release Jul 10, 2026
1.0.0-alpha4 Pre-release Sep 17, 2025
1.0.0-alpha3 Pre-release Apr 30, 2025
1.0.0-alpha2 Pre-release Apr 11, 2025
1.0.0-alpha1 Pre-release Apr 11, 2025