https://github.com/pacificcommunity/django-msgraph_email
https://github.com/pacificcommunity/django-msgraph_email
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pacificcommunity/django-msgraph_email
- Owner: PacificCommunity
- License: mit
- Created: 2025-02-17T21:37:12.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-17T22:17:17.000Z (4 months ago)
- Last Synced: 2025-02-17T23:23:00.044Z (4 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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')
}
```