symfony_mailer_ms_graph
No security coverage
The Symfony Mailer MS Graph module adds a Microsoft Graph API mail transport for the Symfony Mailer module using delegated permissions. Emails are sent as a specific Microsoft 365 mailbox that authorizes this app once via a Microsoft OAuth2 sign-in, rather than as a generic service account — unlike app-only transports such as Symfony Mailer GraphAPI. A refresh token keeps the delegated authorization alive, renewed automatically via cron.
Configuration
- In Microsoft Entra: grant the app registration the Delegated permission
Mail.Send, add theoffline_accessscope (required to receive a refresh token). - In Drupal: go to Administration » Configuration » System » MS Graph Delegated Mailer (
/admin/config/system/symfony-mailer-ms-graph). - Enter the delegated mailbox's email address, Client ID, and Tenant ID; select the Key entity holding the client secret. Save.
- Copy the Redirect URI shown on the form into the Entra app registration's Authentication settings.
- Click "Authorize with Microsoft" and sign in as the mailbox that should send mail.
- Go back to Mailer Transport » Add transport, choose DSN, label it (e.g. "Microsoft Graph (Delegated)"), and enter:
microsoftgraph+delegated://default - Set this as the active transport.
- The refresh token renews automatically via cron (interval configurable on the settings form); use "Refresh access token now" to renew manually, or re-authorize if Microsoft rejects the stored token.
Similar modules
- Symfony Mailer GraphAPI – Application permissions (client credentials) only, no delegated/OAuth2 sign-in option.
- Symfony Mailer Microsoft Graph – Same scope as Symfony Mailer GraphAPI, built on the official Microsoft Graph PHP SDK, also application permissions only.
- Symfony Mailer Lite GraphAPI – Same approach as Symfony Mailer GraphAPI, for use with the Symfony Mailer Lite module instead of Symfony Mailer.
- Symfony Mailer Lite: Microsoft Graph API / oAuth2 Transport – Application permissions transport for Symfony Mailer Lite.
Unlike the modules above, this module additionally supports delegated permissions (OAuth2 authorization code + refresh token), allowing mail to be sent as a specific, real Microsoft 365 mailbox.