You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-11Lines changed: 29 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,12 @@
1
-
# This is my package laravel-msgraph-mail
1
+
# Laravel Microsoft Graph Mail Driver Package
2
2
3
3
[](https://packagist.org/packages/innoge/laravel-msgraph-mail)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
15
-
16
-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
8
+
This package provides a Microsoft Graph mail driver for Laravel. It is an alternative when you don't want to use the
9
+
deprecated and unsecure Basic Auth SMTP driver with Microsoft Office 365.
17
10
18
11
## Installation
19
12
@@ -23,7 +16,22 @@ You can install the package via composer:
23
16
composer require innoge/laravel-msgraph-mail
24
17
```
25
18
26
-
First you need to add a new entry to the mail drivers array in your config/mail.php configuration file:
19
+
## Configuration
20
+
21
+
### Register the Azure App
22
+
23
+
You need to register an Azure App in your Azure AD tenant. You can do this by following the steps in
24
+
the [Microsoft Graph documentation](https://docs.microsoft.com/en-us/graph/auth-register-app-v2).
25
+
26
+
After creating the App you have to add the following permissions to the App:
27
+
Mail.Send (Application permission) you will find it under the "Microsoft Graph" section.
28
+
29
+
Now you have to Grant Admin Consent for the App. You can do this by following the steps in
30
+
the [Microsoft Graph documentation](https://docs.microsoft.com/en-us/graph/auth-v2-service#3-get-administrator-consent).
31
+
32
+
### Configuring your Laravel app
33
+
34
+
First you need to add a new entry to the mail drivers array in your `config/mail.php` configuration file:
27
35
28
36
```php
29
37
'microsoft-graph' => [
@@ -37,6 +45,16 @@ First you need to add a new entry to the mail drivers array in your config/mail.
37
45
],
38
46
],
39
47
```
48
+
49
+
For the `client_id`, `client_secret` and `tenant_id` you need to use the values from the Azure App you created in the
50
+
previous step.
51
+
52
+
Now you can switch your default mail driver to the new `microsoft-graph` driver by setting the env variable:
0 commit comments