← All notes

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

Sources

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

Permanent ID: iil:note:zhg71zyn

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.},
}

Markdown

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.

All artifact files (JSON index)

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.