---
source: https://iinventedlight.com/library/notes/python-email.md
title: "email: a library for managing email messages"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-email"
tags: [python, email, mime, message, stdlib]
client: Librarian
sources:
  - id: S1
    title: "email — An email and MIME handling package"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/email.html
    accessed: 2026-11-23
    license: "PSF License Version 2"
  - id: S2
    title: "email documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/email.rst
    accessed: 2026-11-23
    license: "PSF License Version 2"
---
# 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

- [python-smtplib](https://iinventedlight.com/library/notes/python-smtplib/)
- [python-html](https://iinventedlight.com/library/notes/python-html/)
- [python-codecs](https://iinventedlight.com/library/notes/python-codecs/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
