An open API service indexing awesome lists of open source software.

https://github.com/pacificcommunity/django-msgraph_email


https://github.com/pacificcommunity/django-msgraph_email

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Microsoft Graph Email Backend for Django

An email backend for Django that uses Microsoft Graph to send and receive emails. It uses the `msal` library to retrieve an access token with Microsoft Graph and then uses the Microsoft Graph API to send and receive emails.

Similar to [django-msgraphbackend](https://github.com/danielniccoli/django-msgraphbackend) but with less options and an implementation using the Microsoft Authentication Library (MSAL).

## Installation

To include it in your Django project, add it to your `INSTALLED_APPS` setting:

```python
INSTALLED_APPS = [
...
'msgraph_email',
]
# or
INSTALLED_APPS = INSTALLED_APPS + ('msgraph_email',)
```

Then add the following to your `settings.py` file:

```python
EMAIL_BACKEND = 'msgraph_email.MicrosoftGraphEmailBackend'
GRAPH_API_CREDENTIALS = {
'client_id': 'your-client-id',
'client_secret': 'your-client-secret',
'tenant_id': 'your-tenant-id',
'mail_from': '[email protected]' # to use Django's default email address, set this to os.getenv('DEFAULT_FROM_EMAIL')
}
```