Skip to main content
Django-SendGrid-GAE
===============

Simple Django backend to send email using SendGrid's Web API on GAE using task queues.

Installation
------------

Install the backend from PyPI:

.. code:: bash

pip install fh-django-sendgrid-gae

Add the following to your project's **settings.py**:

.. code:: python

EMAIL_BACKEND = "sgbackend.SendGridBackend"
SENDGRID_API_KEY = "Your SendGrid API Key"

**Done!**

Example
-------

.. code:: python


from django.core.mail import send_mail
from django.core.mail import EmailMultiAlternatives

send_mail("Your Subject", "This is a simple text email body.",
"Test User <test@example.com>", ["test@example.com"])

# or
mail = EmailMultiAlternatives(
subject="Your Subject",
body="This is a simple text email body.",
from_email="Test User <test@example.com>",
to=["test@example.com"],
headers={"Reply-To": "tester@example.com"}
)
# Add template
mail.template_id = 'YOUR TEMPLATE ID FROM SENDGRID ADMIN'

# Replace substitutions in sendgrid template
mail.substitutions = {'%username%': 'testuser'}

# Attach file
with open('somefilename.pdf', 'rb') as file:
mail.attachments = [
('somefilename.pdf', file.read(), 'application/pdf')
]

mail.attach_alternative(
"<p>This is a simple HTML email body</p>", "text/html"
)

mail.send()


License
-------
MIT


Enjoy :)

Metadata

Release files for fh-django-sendgrid-gae 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fh-django-sendgrid-gae 0.2.1
File Size Uploaded Provenance Actions
fh-django-sendgrid-gae-0.2.1.tar.gz 4.2 kB Without provenance Details for fh-django-sendgrid-gae-0.2.1.tar.gz

Release files / fh-django-sendgrid-gae-0.2.1.tar.gz

Download URL fh-django-sendgrid-gae-0.2.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
144d44fc39c683441a1f8fab0436576c322d39b6926cbaf8fd50b14f5e7c6fc0
BLAKE2b-256 checksum
How to use checksums
de259d8ea60160fa9e266fc98df440e2ad014051a3ccbe724db9817d5f3c699f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for fh-django-sendgrid-gae 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page