PHPackages                             codewrap/laravel-microsoft-graph-mailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. codewrap/laravel-microsoft-graph-mailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

codewrap/laravel-microsoft-graph-mailer
=======================================

Laravel mail driver for Microsoft Graph API.

v1.0.0(today)00MITPHPPHP ^8.2CI passing

Since Jun 9Pushed todayCompare

[ Source](https://github.com/CodeWrap/laravel-microsoft-graph-mailer)[ Packagist](https://packagist.org/packages/codewrap/laravel-microsoft-graph-mailer)[ RSS](/packages/codewrap-laravel-microsoft-graph-mailer/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Microsoft Graph Mailer
==============================

[](#laravel-microsoft-graph-mailer)

A Laravel mail driver that sends email via the Microsoft Graph API using OAuth2 client credentials. Zero external dependencies beyond Laravel itself.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- An Azure AD / Entra ID app registration with `Mail.Send` application permission

Installation
------------

[](#installation)

```
composer require codewrap/laravel-microsoft-graph-mailer
```

Azure AD Setup
--------------

[](#azure-ad-setup)

1. Go to **Azure Portal** &gt; **App registrations** &gt; **New registration**
2. Name your app (e.g. "My App Mailer"), select **Single tenant**
3. Go to **API permissions** &gt; **Add permission** &gt; **Microsoft Graph** &gt; **Application permissions** &gt; **Mail.Send** &gt; **Grant admin consent**
4. Go to **Certificates &amp; secrets** &gt; **New client secret** — copy the secret value
5. From the **Overview** page, copy the **Application (client) ID** and **Directory (tenant) ID**

### Restrict Sender Addresses (Recommended)

[](#restrict-sender-addresses-recommended)

By default, `Mail.Send` allows sending as any mailbox in your tenant. To restrict which mailboxes the app can send from, configure an **Application Access Policy** in Exchange Online:

```
New-ApplicationAccessPolicy -AppId  -PolicyScopeGroupId  -AccessRight RestrictAccess
```

Configuration
-------------

[](#configuration)

Add the mailer to `config/mail.php`:

```
'mailers' => [
    'microsoft-graph' => [
        'transport' => 'microsoft-graph',
        'tenant' => env('MAIL_MSGRAPH_TENANT'),
        'client' => env('MAIL_MSGRAPH_CLIENT'),
        'secret' => env('MAIL_MSGRAPH_SECRET'),
        'save_to_sent_items' => env('MAIL_MSGRAPH_SAVE_TO_SENT', true),
    ],
],
```

Add to your `.env`:

```
MAIL_MAILER=microsoft-graph
MAIL_MSGRAPH_TENANT=your-tenant-id
MAIL_MSGRAPH_CLIENT=your-client-id
MAIL_MSGRAPH_SECRET=your-client-secret
MAIL_FROM_ADDRESS=noreply@yourdomain.com
MAIL_FROM_NAME="Your App"

```

The `MAIL_FROM_ADDRESS` must be a valid mailbox in your Microsoft 365 tenant.

Usage
-----

[](#usage)

Once configured as the default mailer, all `Mail::send()` / `Mail::to()` calls use Microsoft Graph automatically. No code changes needed.

Limitations
-----------

[](#limitations)

- **3 MB attachment limit** — Direct file attachments in `sendMail` are limited to 3 MB. Attachments between 3-150 MB require a draft + upload session flow (not yet supported).
- **`X-Message-ID`** — Graph's `sendMail` returns no message ID. The driver generates a local correlation UUID, not an Exchange message ID.

National Clouds
---------------

[](#national-clouds)

For national cloud deployments (US Gov, China), override the API endpoints in your `.env`:

```
MSGRAPH_API_BASE_URL=https://graph.microsoft.us/v1.0
MSGRAPH_AUTH_URL=https://login.microsoftonline.us

```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc4f5c2315d8d27cc70ef660b7d3380400d0ea4e630b1887cb59e3ad0bfda6f3?d=identicon)[CodeWrap](/maintainers/CodeWrap)

---

Top Contributors

[![CodeWrap](https://avatars.githubusercontent.com/u/28383494?v=4)](https://github.com/CodeWrap "CodeWrap (2 commits)")

---

Tags

laravelmailmicrosoftexchangegraph365

### Embed Badge

![Health badge](/badges/codewrap-laravel-microsoft-graph-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/codewrap-laravel-microsoft-graph-mailer/health.svg)](https://phpackages.com/packages/codewrap-laravel-microsoft-graph-mailer)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

43140.3k](/packages/harris21-laravel-fuse)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4923.6k5](/packages/ralphjsmit-laravel-glide)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
