Skip to main content

python-emails

PyPI version Python versions Test status Documentation status License

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

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.

Release files for emails 1.1.3

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

Source distribution (sdist)

Source distribution for emails 1.1.3
File Size Uploaded
emails-1.1.3.tar.gz 38.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for emails 1.1.3
File Interpreter ABI Platform
emails-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 82.9 kB

Release files / emails-1.1.3.tar.gz

Download URL emails-1.1.3.tar.gz
Size 38.6 kB
Tags Source
SHA-256 checksum
How to use checksums
935c70428c664f26e93b410673e59a763baa688886167fd1d50dc03506b17cc5
BLAKE2b-256 checksum
How to use checksums
c0da81560b8c358c35315b3a96e6d80b88fca1607db863370f3266edaa99fe03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / emails-1.1.3-py3-none-any.whl

Download URL emails-1.1.3-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54e3fb6e93c0e687d94afd3e40d21994554e4eca85ea22239d715a72d5199f59
BLAKE2b-256 checksum
How to use checksums
e067c60e8b25bc0134b6b8de84e99c576bbb87060e854ea2f27c51e8a8f405df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6

2 release files

0.5.15

2 release files

0.5.14

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.11

2 release files

0.5.10

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

1 release file

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

3 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.13

2 release files

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

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