Modern python library for emails.
Project description
Build, transform, and send emails in Python with a high-level API.
python-emails helps you compose HTML and plain-text messages, attach files, embed inline images, render templates, apply HTML transformations, sign with DKIM, and send through SMTP without hand-building MIME trees.
Why python-emails
A concise API over email and smtplib
HTML and plain-text messages in one object
File attachments and inline images
CSS inlining, image embedding, and HTML cleanup
Jinja2, Mako, and string template support
DKIM signing
Loaders for URLs, HTML files, directories, ZIP archives, and RFC 822 messages
SMTP sending with SSL/TLS support
Async sending via aiosmtplib
Quick Example
import emails
message = emails.html(
subject="Your receipt",
html="<p>Hello!</p><p>Your payment was received.</p>",
mail_from=("Billing", "billing@example.com"),
)
message.attach(filename="receipt.pdf", data=open("receipt.pdf", "rb"))
response = message.send(
to="customer@example.com",
smtp={
"host": "smtp.example.com",
"port": 587,
"tls": True,
"user": "billing@example.com",
"password": "app-password",
},
)
assert response.status_code == 250
Installation
Install the lightweight core:
pip install emails
Install HTML transformation features such as CSS inlining, image embedding, and loading from URLs or files:
pip install "emails[html]"
Install Jinja2 template support for the JinjaTemplate class:
pip install "emails[jinja]"
Install async SMTP sending support for send_async():
pip install "emails[async]"
Common Tasks
Build and send your first message: Quickstart
Configure installation extras: Install guide
Inline CSS, embed images, and customize HTML processing: Advanced Usage
Learn the full public API: API Reference
Troubleshoot common scenarios: FAQ
Explore alternatives and related projects: Links
What You Get
Message composition for HTML, plain text, headers, CC/BCC, and Reply-To
Attachments, inline images, and MIME generation
Template rendering in html, text, and subject
HTML transformations through message.transform()
SMTP delivery through config dicts or reusable backend objects
Django integration via DjangoMessage
Flask integration via flask-emails
When To Use It
Use python-emails when you need more than a minimal plain-text SMTP call: HTML emails, attachments, inline images, template rendering, DKIM, message loading from external sources, or a cleaner API than hand-written email.mime code.
If you only need to send a very small plain-text message and want zero dependencies, the standard library may be enough.
Documentation
Project Status
python-emails is production/stable software and currently supports Python 3.10 through 3.14.
Contributing
Issues and pull requests are welcome.
License
Apache 2.0. See LICENSE.
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
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 emails-1.1.1.tar.gz.
File metadata
- Download URL: emails-1.1.1.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2ac9d73d84e83d7f1a3924837fa15b59c0bce9bf658ac3b0b80398bc6d8b57d
|
|
| MD5 |
cd68817e6273f1ec68777f80aad57814
|
|
| BLAKE2b-256 |
47a5d5472729b4b56d3868776aef9b43b0803048cc53f8999f1a0f1b4d05c360
|
Provenance
The following attestation bundles were made for emails-1.1.1.tar.gz:
Publisher:
python-publish.yml on lavr/python-emails
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emails-1.1.1.tar.gz -
Subject digest:
f2ac9d73d84e83d7f1a3924837fa15b59c0bce9bf658ac3b0b80398bc6d8b57d - Sigstore transparency entry: 1218235937
- Sigstore integration time:
-
Permalink:
lavr/python-emails@42942e88243a802c5ce322d166e2ccae1d3021a9 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/lavr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@42942e88243a802c5ce322d166e2ccae1d3021a9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file emails-1.1.1-py3-none-any.whl.
File metadata
- Download URL: emails-1.1.1-py3-none-any.whl
- Upload date:
- Size: 42.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
927079dc5c8aec755d017171510c78c0ba56a9f5bf47b0ea82b785f700b43469
|
|
| MD5 |
42a74f9cbf1cb218556da36c5e8bfff6
|
|
| BLAKE2b-256 |
3260fe7f7e4240446400a1cd3358d38887132e34c1abdfdb457ce5acfd108090
|
Provenance
The following attestation bundles were made for emails-1.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on lavr/python-emails
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emails-1.1.1-py3-none-any.whl -
Subject digest:
927079dc5c8aec755d017171510c78c0ba56a9f5bf47b0ea82b785f700b43469 - Sigstore transparency entry: 1218236064
- Sigstore integration time:
-
Permalink:
lavr/python-emails@42942e88243a802c5ce322d166e2ccae1d3021a9 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/lavr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@42942e88243a802c5ce322d166e2ccae1d3021a9 -
Trigger Event:
release
-
Statement type: