PHPackages                             innoge/laravel-msgraph-mail - 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. innoge/laravel-msgraph-mail

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

innoge/laravel-msgraph-mail
===========================

Laravel Mail driver for Microsoft Office 365 using the MSGraph API

1.5.0(2mo ago)73330.8k↓10.1%26[4 issues](https://github.com/InnoGE/laravel-msgraph-mail/issues)[6 PRs](https://github.com/InnoGE/laravel-msgraph-mail/pulls)1MITPHPPHP ^8.1CI passing

Since Feb 13Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/InnoGE/laravel-msgraph-mail)[ Packagist](https://packagist.org/packages/innoge/laravel-msgraph-mail)[ Docs](https://github.com/innoge/laravel-msgraph-mail)[ RSS](/packages/innoge-laravel-msgraph-mail/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (19)Used By (1)

Laravel Microsoft Graph Mail Driver Package
===========================================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/dcad43945943be1c9aa66318d8d15bc227779feecfe7f67d3733f1f7cab2c5fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6e6f67652f6c61726176656c2d6d7367726170682d6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innoge/laravel-msgraph-mail)[![Laravel Version](https://camo.githubusercontent.com/cbc2e934bf3819ec61e053fdf23bc6c629b833292d5440e833b9776277daba65/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d392e7825374331312e7825374331332e782d6f72616e6765)](https://packagist.org/packages/innoge/laravel-rclone)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4e52ed831e11ab2b5ff5420a1b2473f188de0e8daf4f38952221e1ee6b4fc1f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e6e6f67652f6c61726176656c2d6d7367726170682d6d61696c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/innoge/laravel-msgraph-mail/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/88eba7ea2440e916fcbd9851cec6ee9556d67ccdd9e59fced46a88bc51a869ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e6e6f67652f6c61726176656c2d6d7367726170682d6d61696c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/innoge/laravel-msgraph-mail/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/668346912de6233e2c103d9f6e749d615ea225ee8538140283f49ade8b467fa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e6e6f67652f6c61726176656c2d6d7367726170682d6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innoge/laravel-msgraph-mail)

This package provides a Microsoft Graph mail driver for Laravel. It is an alternative when you don't want to use the deprecated and unsecure Basic Auth SMTP driver with Microsoft Office 365.

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

[](#installation)

You can install the package via composer:

```
composer require innoge/laravel-msgraph-mail
```

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

[](#configuration)

### Register the Azure App

[](#register-the-azure-app)

### Microsoft Azure AD Configuration

[](#microsoft-azure-ad-configuration)

I have written a detailed Blog Post how you can configure your Microsoft Azure AD Tenant. [Sending Mails with Laravel and Microsoft Office 365 the secure way](https://geisi.dev/blog/getting-rid-of-deprecated-microsoft-office-365-smtp-mail-sending)

### I want to figure it out on my own

[](#i-want-to-figure-it-out-on-my-own)

You need to register an Azure App in your Azure AD tenant. You can do this by following the steps in the [Microsoft Graph documentation](https://docs.microsoft.com/en-us/graph/auth-register-app-v2).

After creating the App you have to add the following permissions to the App: Mail.Send (Application permission) you will find it under the "Microsoft Graph" section.

Now you have to Grant Admin Consent for the App. You can do this by following the steps in the [Microsoft Graph documentation](https://docs.microsoft.com/en-us/graph/auth-v2-service#3-get-administrator-consent).

### Configuring your Laravel app

[](#configuring-your-laravel-app)

First you need to add a new entry to the mail drivers array in your `config/mail.php` configuration file:

```
'microsoft-graph' => [
    'transport' => 'microsoft-graph',
    'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
    'client_secret' => env('MICROSOFT_GRAPH_CLIENT_SECRET'),
    'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
    'from' => [
        'address' => env('MAIL_FROM_ADDRESS'),
        'name' => env('MAIL_FROM_NAME'),
    ],
    'save_to_sent_items' =>  env('MAIL_SAVE_TO_SENT_ITEMS', false),
],
```

For the `client_id`, `client_secret` and `tenant_id` you need to use the values from the Azure App you created in the previous step.

The `save_to_sent_items` option in Microsoft Graph refers to a parameter that determines whether a sent email should be saved to the sender's "Sent Items" folder within their mailbox. When this option is set to true, the email will be automatically saved to the "Sent Items" folder, providing a record of the communication. Conversely, when it's set to false, the email will not be saved to the "Sent Items" folder.

By default, the save\_to\_sent\_items option is set to false, which means that emails sent through Microsoft Graph won't be saved in the sender's "Sent Items" folder unless explicitly specified otherwise. This behavior can be useful in scenarios where you might want more control over which emails are saved as sent items, perhaps to reduce clutter or ensure confidentiality.

Now you can switch your default mail driver to the new `microsoft-graph` driver by setting the env variable:

```
MAIL_MAILER=microsoft-graph
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Tim Geisendoerfer](https://github.com/InnoGE)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity52

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 61.4% 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 ~79 days

Recently: every ~93 days

Total

15

Last Release

82d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01edc74b3b6f2ecfe6106f68787500e5c46c51acc7fbe7aa04bb378c9190c79b?d=identicon)[geisi](/maintainers/geisi)

---

Top Contributors

[![geisi](https://avatars.githubusercontent.com/u/10728579?v=4)](https://github.com/geisi "geisi (51 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")[![spawnia](https://avatars.githubusercontent.com/u/12158000?v=4)](https://github.com/spawnia "spawnia (5 commits)")[![leeroy869](https://avatars.githubusercontent.com/u/12880155?v=4)](https://github.com/leeroy869 "leeroy869 (3 commits)")[![Heyian](https://avatars.githubusercontent.com/u/8480549?v=4)](https://github.com/Heyian "Heyian (1 commits)")[![joskolenberg](https://avatars.githubusercontent.com/u/26161164?v=4)](https://github.com/joskolenberg "joskolenberg (1 commits)")

---

Tags

laravelinnogelaravel-msgraph-mail

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/innoge-laravel-msgraph-mail/health.svg)

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)[backstage/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24157.5k5](/packages/backstage-laravel-mails)

PHPackages © 2026

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