...
At this point you should have stored these values for use later in our code:
- Application (client) ID.
- Directory (tenant) ID.
- The value of the secret you created for this app.
Set up the application permissions
Looking at the official docs for SendMail, we can see a few ways we can configure our apps to allow sending e-mails. Depending on your scenario, you may want to adjust the permissions between delegated or application permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Mail.Send |
Delegated (personal Microsoft account) | Mail.Send |
Application | Mail.Send |
From the app page in the Azure Portal:
- API permissions > Add a permission
- Microsoft Graph > Application Permissions > Mail.Send > click Add Permission
Your configured permissions should look something like this: