Code Monkey home page Code Monkey logo

laravel-msgraph-mail's Introduction

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.

Tested with different company (Microsoft 365 Business) accounts

Installation

Install the package using composer:

composer require wapacro/laravel-msgraph-mail

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')
    ]

    // ...

]

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

Note: This package relies on Laravel's Cache interface for caching access tokens. Make sure to configure it properly, too!

Version

The latest version is only compatible with Laravel 8.x. Use an older version if you didn't upgrade to Laravel 8 yet:

Package Version Laravel Version
^1.0 7.x
^2.0 8.x

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 (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 & 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 to restrict which email addresses are valid senders for your application.

laravel-msgraph-mail's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.