Looking to hire Laravel developers? Try LaraJobs

laravel-graph-api-mail-driver maintained by sainisch-sczepanski-streller

Description
Send Emails via Microsoft Graph API from your Laravel 10 Project.
Authors
Steven Streller - Adrian Sczepanski - Hanno Sainisch
Last update
2025/07/17 11:15 (dev-main)
License
Downloads
899

Comments
comments powered by Disqus

Laravel Graph API Mail Driver

Send Emails via Microsoft Graph API from your Laravel 10 Project.

Description

Minimal Mail driver to send E-Mails via Microsoft Graph API in Laravel.

Don't forget the app permissions and policies in the Graph API. For further info see: Microsoft Docs

Getting started

install

composer require sainisch-sczepanski-streller/laravel-graph-api-mail-driver

.env

MAIL_FROM_ADDRESS=<your sender address>
MAIL_MAILER=microsoft-graph-api
MAIL_MS_GRAPH_CLIENT_ID=<your client id>
MAIL_MS_GRAPH_CLIENT_SECRET=<your client secret>
MAIL_MS_GRAPH_TENANT_ID=<your tenant id>
MAIL_MS_GRAPH_SAVE_TO_SENT_ITEMS=<bool>

config/mail.php

'mailers' => [

        'microsoft-graph-api' => [
            'transport' => 'microsoft-graph-api',
            'client_id' => env('MAIL_MS_GRAPH_CLIENT_ID'),
            'client_secret' => env('MAIL_MS_GRAPH_CLIENT_SECRET'),
            'tenant_id' => env('MAIL_MS_GRAPH_TENANT_ID'),
            'saveToSentItems' => env('MAIL_MS_GRAPH_SAVE_TO_SENT_ITEMS', true),
        ],
...

Usage

Use it like any other Laravel mail driver

 Mail::to([<recipients>])->send(<your mail class>);

Compatibility

Built and tested in Laravel 10

Contributors

License

The MIT License (MIT). Please see license file for more information.