PHPackages                             paubikas/laravel-msgraph-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. paubikas/laravel-msgraph-mailer

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

paubikas/laravel-msgraph-mailer
===============================

Laravel 9/10 mail driver to send emails using Microsoft Graph, supporting both personal accounts as well as work/school accounts (365/Exchange)

1.2.5(5mo ago)15.1k↓14.6%3MITPHPPHP &gt;=8.2

Since Apr 6Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/paubikas/Laravel-msgraph-mailer)[ Packagist](https://packagist.org/packages/paubikas/laravel-msgraph-mailer)[ RSS](/packages/paubikas-laravel-msgraph-mailer/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (12)Used By (0)

Laravel Microsoft Graph Mail
============================

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

This package makes it easy to send emails from your personal, work or school account using Microsoft's Graph API, allowing you to benefit from HTTP instead of SMTP with Laravel.

Inspired by wapacro/laravel-msgraph-mail and fixed to work with Laravel 12

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

[](#installation)

Install the package using composer:

```
composer require paubikas/laravel-msgraph-mailer

```

Add the configuration to your mail.php config file:

```
'mailers' => [
    'microsoft-graph' => [
        'transport'       => 'microsoft-graph',
        'tenant'          => env('MAIL_MSGRAPH_TENANT', 'common'),
        'client'          => env('MAIL_MSGRAPH_CLIENT'),
        'secret'          => env('MAIL_MSGRAPH_SECRET'),
        'saveToSentItems' => env('MAIL_MSGRAPH_SAVE_TO_SENT_ITEMS', false)
    ]
    // ...
]
```

Add the configuration to your ENV file:

```
MAIL_MAILER=microsoft-graph
MAIL_MSGRAPH_TENANT=
MAIL_MSGRAPH_CLIENT=
MAIL_MSGRAPH_SECRET=
MAIL_MSGRAPH_SAVE_TO_SENT_ITEMS=false
```

Valid values for `tenant` are your tenant identifier (work &amp; school accounts) or `common` for personal accounts.

**Note:** This package relies on [Laravel's Cache](https://laravel.com/docs/cache) interface for caching access tokens. Make sure to configure it properly, too!

### Internal Message Headers and Other Microsoft Graph Custom Headers

[](#internal-message-headers-and-other-microsoft-graph-custom-headers)

To include internal message headers when sending an email via Microsoft Graph, you should use the envelope() function along with the using callback. This allows you to pass custom headers, including internal ones. You can also add other supported headers. For a full list of available headers, refer to the official documentation: [Microsoft Graph Message Resource](https://learn.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0).

Here’s an example of how to add headers:

```
    using: [
        function (Email $email) {
            $email->getHeaders()->addHeader('isReadReceiptRequested', 'true');
            $email->getHeaders()->addHeader('isDeliveryReceiptRequested', 'true');
            $email->getHeaders()->addHeader('internetMessageHeassders', json_encode([
                'X-Test-ID' => 'TestID',
            ]));
        }
    ]
```

### Getting the credentials

[](#getting-the-credentials)

To get the necessary client ID and secret you'll need to register your application and grant it the required permissions. Head over to [the Azure Portal to do so](https://docs.microsoft.com/en-us/graph/auth-register-app-v2)(you don't need to be an Azure user).

Make sure to grant the *Mail.Send* permission and to generate a secret afterwards (may be hidden during app registration).

**Work &amp; School accounts:** Granting your app the *Mail.Send* permission allows you by default to send emails with every valid email address within your company/school. Use an [Exchange Online Application Access Policy](https://docs.microsoft.com/en-us/graph/auth-limit-mailbox-access)to restrict which email addresses are valid senders for your application.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance70

Regular maintenance activity

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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

Every ~96 days

Recently: every ~27 days

Total

11

Last Release

172d ago

PHP version history (2 changes)1.0PHP &gt;=8.1

1.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/517406e778fa5424916200c8c21f4d1bd3211cca185587bf1f19db03ef4311aa?d=identicon)[paubikas](/maintainers/paubikas)

---

Top Contributors

[![paubikas](https://avatars.githubusercontent.com/u/83951420?v=4)](https://github.com/paubikas "paubikas (22 commits)")[![donmbelembe](https://avatars.githubusercontent.com/u/10473277?v=4)](https://github.com/donmbelembe "donmbelembe (1 commits)")[![informatJonas](https://avatars.githubusercontent.com/u/52908178?v=4)](https://github.com/informatJonas "informatJonas (1 commits)")

---

Tags

laravelmailmicrosoftexchangegraph365

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/paubikas-laravel-msgraph-mailer/health.svg)

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

###  Alternatives

[vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

421.7M1](/packages/vemcogroup-laravel-sparkpost-driver)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[therobfonz/laravel-mandrill-driver

Mandrill Driver for Laravel

773.5M](/packages/therobfonz-laravel-mandrill-driver)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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