socialsquared / office365mailer
v1.0.3
2024-09-24 13:56 UTC
Requires
- laravel/framework: >=8.0
- microsoft/microsoft-graph: >=2.14
README
Mail driver for Laravel to send emails using the Microsoft Graph API without user authentication and SMTP. Works for laravel 8 and above
Installation
You can install the package via composer:
composer require socialsquared/office365mailer
Configuration
To use this package you need to create an app in the Azure portal and grant the required permissions. Use these instructions
- Open the Azure Active Directory-Portal with your Office365 Admin account
- Go to
App registrations
and create a new app - Add the required permissions (Mail.Send, User.Read)
- Apply the Admin-Permission for your organization
- Create a new client secret and save the secret and the client id. You will need it later in your
.env
file
Add the following to your .env
file:
MAIL_MAILER=office365
OFFICE365MAIL_CLIENT_ID=your-client-id
OFFICE365MAIL_TENANT=your-tenant-id
OFFICE365MAIL_SECRET=your-client-secret
Add the following to mailer configuration in your config/mail.php
file to the mailers
array:
'office365' => [ 'transport' => 'office365', 'client_id' => env('OFFICE365MAIL_CLIENT_ID'), 'tenant' => env('OFFICE365MAIL_TENANT'), 'client_secret' => env('OFFICE365MAIL_SECRET') ],
Contributing
Feel free to contribute to this package by creating a pull request.