Python email.message: the EmailMessage object model
Answer: EmailMessage is the central class of the email package object model.
Headers and payload
A message has headers plus a payload, also called the content.
A colon separates each field name from its value.
That colon belongs to neither the name nor the value.
What the class provides
Import EmailMessage from the email.message module.
The class is the base of the email object model.
It provides the core functionality for setting and querying header fields.
The same class also opens message bodies and can build structured messages.
See also
Claims
- id: C1 claim: EmailMessage is the base class for the email object model. source: S1 evidence: "It is the base class for the email object model."
- id: C2 claim: The colon is not part of the field name or value. source: S1 evidence: "The colon is not part of either the field name or the field value."
- id: C3 claim: EmailMessage is the base class for the email object model. source: S2 evidence: "It is the base class for the :mod:
emailobject model."
- id: C4 claim: The colon is not part of the field name or value. source: S2 evidence: "The colon is not part of either the field name or the field value."
Sources
- [S1] email.message: Representing an email message. Python Software Foundation. https://docs.python.org/3/library/email.message.html . License: PSF License Version 2. Accessed 2026-11-26.
- [S2] email.message documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/email.message.rst . License: PSF License Version 2. Accessed 2026-11-26.
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.message: Representing an email message; CPython, email.message 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.message: Representing an email message; CPython, email.message documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.
Cite this
iinventedlight. 2026. "Python email.message: the EmailMessage object model." iinventedlight Library, iil:note:1a31x24m, version of 2026-11-26. https://iinventedlight.com/library/notes/python-email-message/. License: CC-BY-4.0.
@misc{iil_note_1a31x24m,
author = {{iinventedlight}},
title = {{Python email.message: the EmailMessage object model}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/python-email-message/},
note = {Permanent ID iil:note:1a31x24m. 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-message.schema.json (schema; CC-BY-4.0)
- python-email-message.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-message.md.