mmsgi-library / entra-mailer
Send email via Microsoft Entra OAuth2 in Laravel
v1.0.1
2025-07-28 03:54 UTC
Requires
- php: >=8.2
- guzzlehttp/guzzle: ^7.9 || ^7.8.1
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
- symfony/mailer: ^6.0 || ^7.0
README
Send emails using Microsoft Entra ID (Azure AD / Microsoft 365) with OAuth2 authentication via Microsoft Graph API.
✨ Features
- OAuth2 (Client Credentials) Authentication
- Uses Microsoft Graph API to send email
- Laravel Service Provider and Config publish
- Supports Laravel Mailer driver integration (custom mailer)
- Easy to use with
Mail::to(...)->send(...)
🛠 Installation
composer require mmsgi-library/entra-mailer php artisan vendor:publish --tag=config ## ENV setting MAIL_MAILER=entra ENTRA_CLIENT_ID=your_client_id ENTRA_CLIENT_SECRET=your_client_secret ENTRA_TENANT_ID=your_tenant_id ENTRA_FROM_ADDRESS=your_sender@domain.com ENTRA_FROM_NAME=Your Name ## Configuration Add this to your `config/mail.php`: ```php 'mailers' => [ ... 'entra' => [ 'transport' => 'entra', ], ], ## use Mail::mailer('entra')->to('target@example.com')->send(new YourMailable());