Skip to content

Socialsquared-gUG/laravel-office365mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel office365 mailer

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.