larzemail
Build, parse and send MIME email the easy way — zero dependencies.
Python's email package is powerful and famously awkward. larzemail wraps it in
a one-object API: set a subject, text and/or HTML body, and attachments, then get
valid MIME bytes — or parse a raw message straight back into a plain object. It
also sends over SMTP, with an injectable connection so your sending code stays
unit-testable.
Install
pip install larzemail
Use
from larzemail import Email
msg = (Email(subject="Your receipt", from_addr="billing@acme.com",
to=["ada@example.com"], cc="ops@acme.com")
.body(text="Thanks for your order.",
html="<h1>Thanks!</h1><p>Your order shipped.</p>")
.attach("receipt.pdf", pdf_bytes, "application/pdf"))
raw = msg.as_bytes() # valid MIME, ready to send
msg.send(host="smtp.acme.com", port=587, username="u", password="p", use_tls=True)
parsed = Email.parse(raw) # -> ParsedEmail
parsed.subject, parsed.text, parsed.html, parsed.attachments
Testable sending
msg.send(connection=fake_smtp) # any object with send_message(msg, from_addr, to_addrs)
Tests
python -m unittest discover -s tests -v # 9 tests
The Larz stack
One of 60+ pure-Python, zero-dependency libraries at github.com/larz-scripter. Pairs with larzpdf (attach a generated invoice) and larzical (attach a calendar invite).
License
MIT (c) larz-scripter
Metadata
Release files for larzemail 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| larzemail-0.1.0.tar.gz | 6.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larzemail-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / larzemail-0.1.0.tar.gz
| Download URL | larzemail-0.1.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df104df2b4ac83721b26c956f4f153573c5b0844c103a4d6a6f1ff9e8644ee2c
|
|
BLAKE2b-256 checksum How to use checksums |
b45d8db0bb07248a75d88042a312e350916e1fafe3ce7fab4f0fa9909decc1ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larzemail-0.1.0-py3-none-any.whl
| Download URL | larzemail-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cdcf3eab4075c291d14a43d5e4cc90b5f9939cee85ba86f3e72450898fba713
|
|
BLAKE2b-256 checksum How to use checksums |
eda059b7e3019b11503a97ebf13a8774006c40cc66163370c2a2909630438c41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larzemail 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.