GSuite Email Backend
This package allows to use Django's send_mail command to send emails through GSuite account.
It requires a serviceaccount credential created in Google coud console,
The crendential file need to have https://www.googleapis.com/auth/gmail.send scope.
Follow this tutorial to create the credentials file, make sure to add https://www.googleapis.com/auth/gmail.send scope.
Installation
pip install django-gsuite-email
Quick start
1. Add it to installed apps in setings.py
INSTALLED_APPS = [
...
'django_gsuite_email',
...
]
2. Set the Email EMAIL_BACKEND setting
EMAIL_BACKEND = 'django_gsuite_email.GSuiteEmailBackend'
3. Set location of credentials file.
To do this, either set GSUITE_CREDENTIALS_FILE environment variable.
OR
set GSUITE_CREDENTIALS_FILE in settings.py
GSUITE_CREDENTIALS_FILE="/path/to/credentials/file.json"
GSUITE_USER_FROM_EMAIL = False # use the user of from_email if True. Default value False.
GMAIL_USER = 'user@domain' # default user if GSUITE_USER_FROM_EMAIL is not True. Default value None.
GMAIL_SCOPES = ['https://www.googleapis.com/auth/gmail.send', ... ] # Default value ['https://www.googleapis.com/auth/gmail.send', ]
Note:
GSUITE_CREDENTIALS_FILEinsettings.pywill take precedence over environment variable.
4. Send emails
from django.core.mail import send_mail
send_mail(
'Subject here',
'Here is the message.',
'from@example.com',
['to@example.com'],
fail_silently=False,
)
Release files for djau-gsuite-email 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| djau_gsuite_email-0.1.6.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| djau_gsuite_email-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / djau_gsuite_email-0.1.6.tar.gz
| Download URL | djau_gsuite_email-0.1.6.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86dfd004e960f8b74611f15ca6331dba5e4e819873d034f8daf6ca0b52d34c0a
|
|
BLAKE2b-256 checksum How to use checksums |
137d4b47afe323b94ac8ddc52269600fbb4b66bfb1934c911e3257024533f6d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / djau_gsuite_email-0.1.6-py3-none-any.whl
| Download URL | djau_gsuite_email-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfe067285b742fbe8f7717cc4e48ce0cd48192df611a2f4de75c1447f618c76b
|
|
BLAKE2b-256 checksum How to use checksums |
83c7031dcb62ae5554fc37d2efb179f369287961af12e9ea662e5899e860f06e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|