Skip to main content

django-bootstrap-email

Usage

  1. Install
pip install django-bs-email
  1. Add to INSTALLED_APPS
INSTALLED_APPS = [
    # ...
    "django_bootstrap_email",
]
  1. Use the bootstrap_email template tag in your Django template
{% load bootstrap_email %}

{% bootstrap_email %}
<body class="bg-light">
  <div class="container">
    <div class="card my-10">
      <div class="card-body">
          <p>
            {{ message }}
          </p>
      </div>
    </div>
  </div>
</body>
{% end_bootstrap_email %}
  1. Create the email and send it
context = {
    "message": "Hello World!",
}

# you should always include a plain text version of the HTML email
text_content = context["message"]
html_content = render_to_string("path/to/template.html", context)

email_message = EmailMultiAlternatives(
    subject="Greetings",
    body=text_content,
    from_email="me@test.com",
    to=["you@test.com"],
)
email_message.attach_alternative(html_content, "text/html")
email_message.send()

This will produce a complete HTML email that renders consistently across email clients:

Rendered HTML email example

Release files for django-bs-email 0.2.2

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

Source distribution (sdist)

Source distribution for django-bs-email 0.2.2
File Size Uploaded
django_bs_email-0.2.2.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-bs-email 0.2.2
File Interpreter ABI Platform
django_bs_email-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / django_bs_email-0.2.2.tar.gz

Download URL django_bs_email-0.2.2.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3074d222642c31dbcd3f263f65a855be3036f69bdd8f555582d59a6229bb4c33
BLAKE2b-256 checksum
How to use checksums
59421f3261b1d9ebc271d144459d7fbe796fefd01187b7bdcb66c69151938f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / django_bs_email-0.2.2-py3-none-any.whl

Download URL django_bs_email-0.2.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1505a02450d394c14ca590a4d258d49192fd41074aaf3a2b533c152b56992f93
BLAKE2b-256 checksum
How to use checksums
6a2105ffda7d948f1e05604a052318183d9a7bb46077b2d3e1841d1d561b4a39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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