Download the PHP package delaneydev/microsoftgraph-365-mail without Composer

On this page you can find all versions of the php package delaneydev/microsoftgraph-365-mail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package microsoftgraph-365-mail

Latest Version on Packagist Total Downloads

Laravel Microsoft Graph (DelaneyDev Fork) Native Laravel Microsoft Mail driver

What this package does

This package is a Laravel mail driver for Microsoft 365 that sends email via Microsoft Graph (OAuth2).
It’s perfect for:

This is a fork of lloadout/microsoftgraph.
DelaneyDev adds Single-User Mode (database-stored token; no session required) while still supporting the original Session Mode.


Quick Start (TL;DR)

1) Install & Publish + migrate

  1. Create Azure App (delegated Mail.Send) and put IDs/secrets in .env (see below)

  2. Connect once at /microsoft/connect while signed in as the sending mailbox (e.g., noreply@...)

  3. Use like normal:

1) Azure App — Create and Grant Delegated Mail.Send (don’t change anything else)

  1. Azure Portal → Azure Active Directory → App registrations → New registration
  2. Name: Laravel Microsoft Graph Mailer
  3. Supported account types: your tenant only (or multi-tenant if required)
  4. Redirect URI (Web):

  5. Register

Copy credentials into .env:

Grant permissions:


2) Configure .env

Set these for both modes. (Choose mode in the next section.)


3) Choose a Mode

A) Single-User Mode (Recommended for no-reply & single mailbox)

What it is: Your app always sends as one mailbox (e.g., [email protected]). Tokens are stored in the database (encrypted), not in the session. No per-request user login required.

Enable in .env:

Listen for the OAuth callback and store tokens (once): Add to AppServiceProvider or EventServiceProvider:

Connect once as the sending mailbox:

Accept consent. The token is saved and will be reused automatically.

After this, you can send mail without any user sessions:


B) Session Mode (Upstream behaviour; per-user tokens)

What it is: Each signed-in user authenticates with Microsoft; tokens are stored in session and used per request.

Enable in .env:

Routes:

Put access data in the session after callback (example listener):

The package looks for session('microsoftgraph-access-data') when connecting.


4) Sending Email (same in both modes)

Required API permission: Mail.Send (Delegated)

.env:

Examples:


5) Package Capabilities (Beyond Mail)

This package wraps Microsoft Graph endpoints for:

You only need Mail.Send to send mail. Other features require additional permissions (see below).


Storage usage (OneDrive)

Permission: Files.ReadWrite.All .env:

Use the onedrive disk like any Laravel filesystem disk:


Teams usage

Permission: Chat.ReadWrite (Extra examples require Group.Read.All, Chat.Read.All, ChannelMessage.Read.All, ChannelMessage.Send)


Excel usage

Permission: Files.ReadWrite.All


Calendar usage

Permission: Calendars.ReadWrite


Contacts usage

Permission: Contacts.ReadWrite


Reading and handling mail

Permissions: Mail.Read, Mail.ReadWrite, Mail.ReadBasic

Available methods


Differences: DelaneyDev Fork vs Upstream

Topic DelaneyDev (this fork) Upstream (lloadout/microsoftgraph)
Primary goal Single-User Mode for no-reply/single mailbox sending Session-based per-user OAuth
Token storage Database (encrypted) via model/migration Session (microsoftgraph-access-data)
Sessions needed to send mail No (after initial connect) Yes (user must have session token)
Best for System emails, cron, queues, workers User-initiated emails on behalf of each user
Session Mode Still supported N/A (original behavior)

You can enable either mode via .env.


Troubleshooting


Testing

Changelog

See CHANGELOG.

Contributing

See CONTRIBUTING.

Security Vulnerabilities

Please review our security policy.

Credits

License

MIT — see LICENSE.


All versions of microsoftgraph-365-mail with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-fileinfo Version *
illuminate/contracts Version ^9|^10.0|^11.0|^12.0
microsoft/microsoft-graph Version ^1.89
socialiteproviders/microsoft Version ^4.2
spatie/laravel-package-tools Version ^1.14.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package delaneydev/microsoftgraph-365-mail contains the following files

Loading the files please wait ...