email: a library for managing email messages
Answer: The email package is a library for managing email messages. Sending to SMTP or NNTP servers is out of scope; use modules such as smtplib for that. A parser, a generator, and a policy object sit around an EmailMessage tree.
What the package is for
This package is a library for managing email messages.
Sending those messages to SMTP, NNTP, or other servers is specifically not its job. Those are functions of modules such as smtplib.
The package supports RFC 5322 and also MIME-related RFCs such as RFC 2045.
Object model, parser, generator, and policy
The structure has three major components, plus a fourth that controls the others.
At the center is an object model: a tree whose nodes all provide the EmailMessage API.
A parser turns a serialized message into that tree, and a generator goes the other way.
Each message, parser, and generator carries a policy object that controls behavior.
See also
Claims
- id: C1 claim: The email package is a library for managing email messages. source: S1 evidence: "library for managing email messages"
- id: C2 claim: It is specifically not designed to send mail to SMTP servers. source: S2 evidence: "specifically not designed to do any sending of email messages to SMTP"
- id: C3 claim: The object model is a tree that provides the EmailMessage API. source: S1 evidence: "provide the EmailMessage API"
- id: C4 claim: A policy object controls parser, generator, and message behavior. source: S1 evidence: "policy object that controls its behavior"
Sources
- [S1] email — An email and MIME handling package. Python Software Foundation. https://docs.python.org/3/library/email.html . License: PSF License Version 2. Accessed 2026-11-23.
- [S2] email documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/email.rst . License: PSF License Version 2. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, email — An email and MIME handling package; CPython, email documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, email — An email and MIME handling package; CPython, email documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.
Cite this
iinventedlight. 2026. "email: a library for managing email messages." iinventedlight Library, iil:note:zhg71zyn, version of 2026-11-23. https://iinventedlight.com/library/notes/python-email/. License: CC-BY-4.0.
@misc{iil_note_zhg71zyn,
author = {{iinventedlight}},
title = {{email: a library for managing email messages}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/python-email/},
note = {Permanent ID iil:note:zhg71zyn. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-email.schema.json (schema; CC-BY-4.0)
- python-email.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-email.md.