django-bootstrap-email
Usage
- Install
pip install django-bs-email
- Add to
INSTALLED_APPS
INSTALLED_APPS = [
# ...
"django_bootstrap_email",
]
- Use the
bootstrap_emailtemplate 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 %}
- 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:
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)
| File | Size | Uploaded | |
|---|---|---|---|
| django_bs_email-0.2.2.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|