Send emails via a GSuite Service-account.
Project description
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"
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,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-gsuite-email-0.1.2.tar.gz.
File metadata
- Download URL: django-gsuite-email-0.1.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5a65eca01443afec01c4574c0b066a0e0118eaebb2149a3043a72106ea3fde0
|
|
| MD5 |
ffcbc5ca64183546760ce1261e5ed177
|
|
| BLAKE2b-256 |
28d83b20a2b8f2e190b97fb4871b5ca7bf8d209b02f186baca960f169ce4f0aa
|
File details
Details for the file django_gsuite_email-0.1.2-py2.py3-none-any.whl.
File metadata
- Download URL: django_gsuite_email-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e36793926210f7f72a40b157f404974d44ee23f6ef6972ef720aa1d3bb788ad
|
|
| MD5 |
d762ce4bf3cd40fe64ecd5c10b27f09e
|
|
| BLAKE2b-256 |
83a509e619529329d3938708e344ab83da74fb6f0158374cc5e21cc15deb885e
|