Mail driver for the Laravel framework to send emails using Microsoft Graph without user authentication and SMTP. Only specify the E-Mail-Address in the FROM-Header of the E-Mail and this Office 365 Package will send the E-Mail trough the Microsoft Graph-Api and put the sent E-Mail in the sender's Mailbox sent folder.
Key features:
To use this package you have to register your application here. More informations here.
You can install the package with Composer, either run composer require motze92/office365-mail
, or edit your composer.json
file:
For Laravel 9 please use
{
"require": {
"motze92/office365-mail": "^3.0"
}
}
For Laravel 8 please use
{
"require": {
"motze92/office365-mail": "^2.0"
}
}
For Laravel 6 and earlier please use
{
"require": {
"motze92/office365-mail": "^1.0"
}
}
To publish the config file use this command:
php artisan vendor:publish --tag=office365mail
To obtain needed config values use this instructions:
Manage
> API-Permissions
> Application Permissions
add the Mail.ReadWrite
and the Mail.Send
permission (Microsoft Graph > Application Permissions > Mail > Mail.ReadWrite and Microsoft Graph > Application Permissions > Mail > Mail.Send).env
- Variable OFFICE365MAIL_CLIENT_SECRET
The Mail.ReadWrite
Permission is needed when sending large attachments (>4MB).
MAIL_DRIVER=office365mail
OFFICE365MAIL_CLIENT_ID=YOUR-MS-GRAPH-CLIENT-ID
OFFICE365MAIL_TENANT=YOUR-MS-GRAPH-TENANT-ID
OFFICE365MAIL_CLIENT_SECRET=YOUR-MS-GRAPH-CLIENT-SECRET
MAIL_MAILER=office365mail
OFFICE365MAIL_CLIENT_ID=YOUR-MS-GRAPH-CLIENT-ID
OFFICE365MAIL_TENANT=YOUR-MS-GRAPH-TENANT-ID
OFFICE365MAIL_CLIENT_SECRET=YOUR-MS-GRAPH-CLIENT-SECRET
'office365mail' => [
'transport' => 'office365mail',
],
Moritz Mair, Matthias Radmüller, Merlin Mayr
Copyright (c) Moritz Mair. All Rights Reserved. Licensed under the MIT license.