SendGrid Backend for Django
Project description
Simple django backend to send email using SendGrid’s Web API.
Installation
Install the backend from PyPI:
pip install sendgrid-django
Add the following to your project’s settings.py:
EMAIL_BACKEND = "sgbackend.SendGridBackend"
SENDGRID_USER = "Your SendGrid Username"
SENDGRID_PASSWORD = "Your SendGrid Password"
Done!
Example
from django.core.mail import send_mail
from django.core.mail import EmailMultiAlternatives
send_mail("Your Subject", "This is a simple text email body.",
"Yamil Asusta <hello@yamilasusta.com>", ["yamil@sendgrid.com"])
# or
mail = EmailMultiAlternatives(
subject="Your Subject",
body="This is a simple text email body.",
from_email="Yamil Asusta <hello@yamilasusta.com>",
to=["yamil@sendgrid.com"],
headers={"Reply-To": "support@sendgrid.com"}
)
mail.attach_alternative("<p>This is a simple HTML email body</p>", "text/html")
mail.send()
MIT
Enjoy :)
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
sendgrid-django-1.0.2.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file sendgrid-django-1.0.2.tar.gz
.
File metadata
- Download URL: sendgrid-django-1.0.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85afe369b230df75484b81cdd872fa522b3c8e9c46fca5eb3608008e31fc0dcb |
|
MD5 | 221d931d51398d3f7bf5521fc4237223 |
|
BLAKE2b-256 | a94398c702220d80336dc45e561c12afa85236bce1f4e4c2fd8e682dc2ee8573 |
File details
Details for the file sendgrid-django-1.0.2.macosx-10.9-intel.exe
.
File metadata
- Download URL: sendgrid-django-1.0.2.macosx-10.9-intel.exe
- Upload date:
- Size: 66.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694b22f212dda9dff01b7952ec563224c68e9b8c25bca506825132d2a6f42845 |
|
MD5 | 374a66082759017ecaa420862f180564 |
|
BLAKE2b-256 | bda9f25448bd7d8251361a8c8db579f280d4bdcdaeaaf75a5a1f297e3fed56fa |