Django application with Bootstrap email template tag.
Project description
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:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_bs_email-0.2.2.tar.gz
(3.6 kB
view details)
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_bs_email-0.2.2.tar.gz.
File metadata
- Download URL: django_bs_email-0.2.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3074d222642c31dbcd3f263f65a855be3036f69bdd8f555582d59a6229bb4c33
|
|
| MD5 |
d0507377810a2ee4cda2e0a4fee3b851
|
|
| BLAKE2b-256 |
59421f3261b1d9ebc271d144459d7fbe796fefd01187b7bdcb66c69151938f49
|
File details
Details for the file django_bs_email-0.2.2-py3-none-any.whl.
File metadata
- Download URL: django_bs_email-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1505a02450d394c14ca590a4d258d49192fd41074aaf3a2b533c152b56992f93
|
|
| MD5 |
632959306412c9958372bfb0e676f1e7
|
|
| BLAKE2b-256 |
6a2105ffda7d948f1e05604a052318183d9a7bb46077b2d3e1841d1d561b4a39
|