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 mail driver to send emails using Microsoft Graph, supporting both personal accounts as well as work/school accounts (365/Exchange)

1.2.6(2mo ago)16.8k↓25.3%3[1 issues](https://github.com/paubikas/Laravel-msgraph-mailer/issues)MITPHPPHP &gt;=8.2

Since Apr 6Pushed 2mo 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 3d ago

READMEChangelog (9)Dependencies (16)Versions (14)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/13

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

46

—

FairBetter than 92% of packages

Maintenance63

Regular maintenance activity

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.5% 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 ~99 days

Recently: every ~61 days

Total

12

Last Release

89d 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 (23 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M577](/packages/shopware-core)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)

PHPackages © 2026

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