442 lines
32 KiB
HTML
442 lines
32 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html lang="en" data-content_root="../">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta property="og:title" content="email — An email and MIME handling package" />
|
|
<meta property="og:type" content="website" />
|
|
<meta property="og:url" content="https://docs.python.org/3/library/email.html" />
|
|
<meta property="og:site_name" content="Python documentation" />
|
|
<meta property="og:description" content="Source code: Lib/email/__init__.py The email package is a library for managing email messages. It is specifically not designed to do any sending of email messages to SMTP ( RFC 2821), NNTP, or othe..." />
|
|
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
<meta property="og:image:alt" content="Python documentation" />
|
|
<meta name="description" content="Source code: Lib/email/__init__.py The email package is a library for managing email messages. It is specifically not designed to do any sending of email messages to SMTP ( RFC 2821), NNTP, or othe..." />
|
|
<meta property="og:image:width" content="200">
|
|
<meta property="og:image:height" content="200">
|
|
<meta name="theme-color" content="#3776ab">
|
|
|
|
<title>email — An email and MIME handling package — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
|
|
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
|
|
<script src="../_static/sidebar.js"></script>
|
|
|
|
<link rel="search" type="application/opensearchdescription+xml"
|
|
title="Search within Python 3.13.3 documentation"
|
|
href="../_static/opensearch.xml"/>
|
|
<link rel="author" title="About these documents" href="../about.html" />
|
|
<link rel="index" title="Index" href="../genindex.html" />
|
|
<link rel="search" title="Search" href="../search.html" />
|
|
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
<link rel="next" title="email.message: Representing an email message" href="email.message.html" />
|
|
<link rel="prev" title="Internet Data Handling" href="netdata.html" />
|
|
|
|
<link rel="canonical" href="https://docs.python.org/3/library/email.html">
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
@media only screen {
|
|
table.full-width-table {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
<meta name="readthedocs-addons-api-version" content="1">
|
|
|
|
</head>
|
|
<body>
|
|
<div class="mobile-nav">
|
|
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
<nav class="nav-content" role="navigation">
|
|
<label for="menuToggler" class="toggler__label">
|
|
<span></span>
|
|
</label>
|
|
<span class="nav-items-wrapper">
|
|
<a href="https://www.python.org/" class="nav-logo">
|
|
<img src="../_static/py.svg" alt="Python logo"/>
|
|
</a>
|
|
<span class="version_switcher_placeholder"></span>
|
|
<form role="search" class="search" action="../search.html" method="get">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
</svg>
|
|
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
<input type="submit" value="Go"/>
|
|
</form>
|
|
</span>
|
|
</nav>
|
|
<div class="menu-wrapper">
|
|
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
<div class="language_switcher_placeholder"></div>
|
|
|
|
<label class="theme-selector-label">
|
|
Theme
|
|
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
<option value="auto" selected>Auto</option>
|
|
<option value="light">Light</option>
|
|
<option value="dark">Dark</option>
|
|
</select>
|
|
</label>
|
|
<div>
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="netdata.html"
|
|
title="previous chapter">Internet Data Handling</a></p>
|
|
</div>
|
|
<div>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="email.message.html"
|
|
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.message</span></code>: Representing an email message</a></p>
|
|
</div>
|
|
<div role="note" aria-label="source link">
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
<li>
|
|
<a href="https://github.com/python/cpython/blob/main/Doc/library/email.rst"
|
|
rel="nofollow">Show Source
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="related" role="navigation" aria-label="Related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="../genindex.html" title="General Index"
|
|
accesskey="I">index</a></li>
|
|
<li class="right" >
|
|
<a href="../py-modindex.html" title="Python Module Index"
|
|
>modules</a> |</li>
|
|
<li class="right" >
|
|
<a href="email.message.html" title="email.message: Representing an email message"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="netdata.html" title="Internet Data Handling"
|
|
accesskey="P">previous</a> |</li>
|
|
|
|
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
<li class="switchers">
|
|
<div class="language_switcher_placeholder"></div>
|
|
<div class="version_switcher_placeholder"></div>
|
|
</li>
|
|
<li>
|
|
|
|
</li>
|
|
<li id="cpython-language-and-version">
|
|
<a href="../index.html">3.13.3 Documentation</a> »
|
|
</li>
|
|
|
|
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
|
|
<li class="nav-item nav-item-2"><a href="netdata.html" accesskey="U">Internet Data Handling</a> »</li>
|
|
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code> — An email and MIME handling package</a></li>
|
|
<li class="right">
|
|
|
|
|
|
<div class="inline-search" role="search">
|
|
<form class="inline-search" action="../search.html" method="get">
|
|
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
<input type="submit" value="Go" />
|
|
</form>
|
|
</div>
|
|
|
|
|
</li>
|
|
<li class="right">
|
|
<label class="theme-selector-label">
|
|
Theme
|
|
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
<option value="auto" selected>Auto</option>
|
|
<option value="light">Light</option>
|
|
<option value="dark">Dark</option>
|
|
</select>
|
|
</label> |</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body" role="main">
|
|
|
|
<section id="module-email">
|
|
<span id="email-an-email-and-mime-handling-package"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code> — An email and MIME handling package<a class="headerlink" href="#module-email" title="Link to this heading">¶</a></h1>
|
|
<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/Lib/email/__init__.py">Lib/email/__init__.py</a></p>
|
|
<hr class="docutils" />
|
|
<p>The <a class="reference internal" href="#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package is a library for managing email messages. It is
|
|
specifically <em>not</em> designed to do any sending of email messages to SMTP
|
|
(<span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2821.html"><strong>RFC 2821</strong></a>), NNTP, or other servers; those are functions of modules such as
|
|
<a class="reference internal" href="smtplib.html#module-smtplib" title="smtplib: SMTP protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">smtplib</span></code></a>. The <a class="reference internal" href="#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package attempts to be as
|
|
RFC-compliant as possible, supporting <span class="target" id="index-1"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5322.html"><strong>RFC 5322</strong></a> and <span class="target" id="index-2"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6532.html"><strong>RFC 6532</strong></a>, as well as
|
|
such MIME-related RFCs as <span class="target" id="index-3"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2045.html"><strong>RFC 2045</strong></a>, <span class="target" id="index-4"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2046.html"><strong>RFC 2046</strong></a>, <span class="target" id="index-5"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2047.html"><strong>RFC 2047</strong></a>, <span class="target" id="index-6"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2183.html"><strong>RFC 2183</strong></a>,
|
|
and <span class="target" id="index-7"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2231.html"><strong>RFC 2231</strong></a>.</p>
|
|
<p>The overall structure of the email package can be divided into three major
|
|
components, plus a fourth component that controls the behavior of the other
|
|
components.</p>
|
|
<p>The central component of the package is an “object model” that represents email
|
|
messages. An application interacts with the package primarily through the
|
|
object model interface defined in the <a class="reference internal" href="email.message.html#module-email.message" title="email.message: The base class representing email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">message</span></code></a> sub-module. The
|
|
application can use this API to ask questions about an existing email, to
|
|
construct a new email, or to add or remove email subcomponents that themselves
|
|
use the same object model interface. That is, following the nature of email
|
|
messages and their MIME subcomponents, the email object model is a tree
|
|
structure of objects that all provide the <a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a>
|
|
API.</p>
|
|
<p>The other two major components of the package are the <a class="reference internal" href="email.parser.html#module-email.parser" title="email.parser: Parse flat text email messages to produce a message object structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code></a> and
|
|
the <a class="reference internal" href="email.generator.html#module-email.generator" title="email.generator: Generate flat text email messages from a message structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">generator</span></code></a>. The parser takes the serialized version of an
|
|
email message (a stream of bytes) and converts it into a tree of
|
|
<a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a> objects. The generator takes an
|
|
<a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a> and turns it back into a serialized byte
|
|
stream. (The parser and generator also handle streams of text characters, but
|
|
this usage is discouraged as it is too easy to end up with messages that are
|
|
not valid in one way or another.)</p>
|
|
<p>The control component is the <a class="reference internal" href="email.policy.html#module-email.policy" title="email.policy: Controlling the parsing and generating of messages"><code class="xref py py-mod docutils literal notranslate"><span class="pre">policy</span></code></a> module. Every
|
|
<a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a>, every <a class="reference internal" href="email.generator.html#module-email.generator" title="email.generator: Generate flat text email messages from a message structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">generator</span></code></a>, and every
|
|
<a class="reference internal" href="email.parser.html#module-email.parser" title="email.parser: Parse flat text email messages to produce a message object structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code></a> has an associated <a class="reference internal" href="email.policy.html#module-email.policy" title="email.policy: Controlling the parsing and generating of messages"><code class="xref py py-mod docutils literal notranslate"><span class="pre">policy</span></code></a> object that
|
|
controls its behavior. Usually an application only needs to specify the policy
|
|
when an <a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a> is created, either by directly
|
|
instantiating an <a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a> to create a new email,
|
|
or by parsing an input stream using a <a class="reference internal" href="email.parser.html#module-email.parser" title="email.parser: Parse flat text email messages to produce a message object structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code></a>. But the policy can
|
|
be changed when the message is serialized using a <a class="reference internal" href="email.generator.html#module-email.generator" title="email.generator: Generate flat text email messages from a message structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">generator</span></code></a>.
|
|
This allows, for example, a generic email message to be parsed from disk, but
|
|
to serialize it using standard SMTP settings when sending it to an email
|
|
server.</p>
|
|
<p>The email package does its best to hide the details of the various governing
|
|
RFCs from the application. Conceptually the application should be able to
|
|
treat the email message as a structured tree of unicode text and binary
|
|
attachments, without having to worry about how these are represented when
|
|
serialized. In practice, however, it is often necessary to be aware of at
|
|
least some of the rules governing MIME messages and their structure,
|
|
specifically the names and nature of the MIME “content types” and how they
|
|
identify multipart documents. For the most part this knowledge should only be
|
|
required for more complex applications, and even then it should only be the
|
|
high level structure in question, and not the details of how those structures
|
|
are represented. Since MIME content types are used widely in modern internet
|
|
software (not just email), this will be a familiar concept to many programmers.</p>
|
|
<p>The following sections describe the functionality of the <a class="reference internal" href="#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package.
|
|
We start with the <a class="reference internal" href="email.message.html#module-email.message" title="email.message: The base class representing email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">message</span></code></a> object model, which is the primary
|
|
interface an application will use, and follow that with the
|
|
<a class="reference internal" href="email.parser.html#module-email.parser" title="email.parser: Parse flat text email messages to produce a message object structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code></a> and <a class="reference internal" href="email.generator.html#module-email.generator" title="email.generator: Generate flat text email messages from a message structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">generator</span></code></a> components. Then we cover the
|
|
<a class="reference internal" href="email.policy.html#module-email.policy" title="email.policy: Controlling the parsing and generating of messages"><code class="xref py py-mod docutils literal notranslate"><span class="pre">policy</span></code></a> controls, which completes the treatment of the main
|
|
components of the library.</p>
|
|
<p>The next three sections cover the exceptions the package may raise and the
|
|
defects (non-compliance with the RFCs) that the <a class="reference internal" href="email.parser.html#module-email.parser" title="email.parser: Parse flat text email messages to produce a message object structure."><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code></a> may
|
|
detect. Then we cover the <a class="reference internal" href="email.headerregistry.html#module-email.headerregistry" title="email.headerregistry: Automatic Parsing of headers based on the field name"><code class="xref py py-mod docutils literal notranslate"><span class="pre">headerregistry</span></code></a> and the
|
|
<a class="reference internal" href="email.contentmanager.html#module-email.contentmanager" title="email.contentmanager: Storing and Retrieving Content from MIME Parts"><code class="xref py py-mod docutils literal notranslate"><span class="pre">contentmanager</span></code></a> sub-components, which provide tools for doing more
|
|
detailed manipulation of headers and payloads, respectively. Both of these
|
|
components contain features relevant to consuming and producing non-trivial
|
|
messages, but also document their extensibility APIs, which will be of interest
|
|
to advanced applications.</p>
|
|
<p>Following those is a set of examples of using the fundamental parts of the APIs
|
|
covered in the preceding sections.</p>
|
|
<p>The foregoing represent the modern (unicode friendly) API of the email package.
|
|
The remaining sections, starting with the <a class="reference internal" href="email.compat32-message.html#email.message.Message" title="email.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>
|
|
class, cover the legacy <a class="reference internal" href="email.policy.html#email.policy.compat32" title="email.policy.compat32"><code class="xref py py-data docutils literal notranslate"><span class="pre">compat32</span></code></a> API that deals much more
|
|
directly with the details of how email messages are represented. The
|
|
<a class="reference internal" href="email.policy.html#email.policy.compat32" title="email.policy.compat32"><code class="xref py py-data docutils literal notranslate"><span class="pre">compat32</span></code></a> API does <em>not</em> hide the details of the RFCs from
|
|
the application, but for applications that need to operate at that level, they
|
|
can be useful tools. This documentation is also relevant for applications that
|
|
are still using the <a class="reference internal" href="email.policy.html#email.policy.compat32" title="email.policy.compat32"><code class="xref py py-mod docutils literal notranslate"><span class="pre">compat32</span></code></a> API for backward
|
|
compatibility reasons.</p>
|
|
<div class="versionchanged">
|
|
<p><span class="versionmodified changed">Changed in version 3.6: </span>Docs reorganized and rewritten to promote the new
|
|
<a class="reference internal" href="email.message.html#email.message.EmailMessage" title="email.message.EmailMessage"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailMessage</span></code></a>/<a class="reference internal" href="email.policy.html#email.policy.EmailPolicy" title="email.policy.EmailPolicy"><code class="xref py py-class docutils literal notranslate"><span class="pre">EmailPolicy</span></code></a>
|
|
API.</p>
|
|
</div>
|
|
<p>Contents of the <a class="reference internal" href="#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package documentation:</p>
|
|
<div class="toctree-wrapper compound">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.message.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.message</span></code>: Representing an email message</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.parser.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.parser</span></code>: Parsing email messages</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="email.parser.html#feedparser-api">FeedParser API</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="email.parser.html#parser-api">Parser API</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="email.parser.html#additional-notes">Additional notes</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.generator.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.generator</span></code>: Generating MIME documents</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.policy.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.policy</span></code>: Policy Objects</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.errors.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.errors</span></code>: Exception and Defect classes</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.headerregistry.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.headerregistry</span></code>: Custom Header Objects</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.contentmanager.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.contentmanager</span></code>: Managing MIME Content</a><ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="email.contentmanager.html#content-manager-instances">Content Manager Instances</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.examples.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code>: Examples</a></li>
|
|
</ul>
|
|
</div>
|
|
<p>Legacy API:</p>
|
|
<div class="toctree-wrapper compound">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.compat32-message.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.message.Message</span></code>: Representing an email message using the <code class="xref py py-data docutils literal notranslate"><span class="pre">compat32</span></code> API</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.mime.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.mime</span></code>: Creating email and MIME objects from scratch</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.header.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.header</span></code>: Internationalized headers</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.charset.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.charset</span></code>: Representing character sets</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.encoders.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.encoders</span></code>: Encoders</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.utils.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.utils</span></code>: Miscellaneous utilities</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="email.iterators.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.iterators</span></code>: Iterators</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="admonition seealso">
|
|
<p class="admonition-title">See also</p>
|
|
<dl class="simple">
|
|
<dt>Module <a class="reference internal" href="smtplib.html#module-smtplib" title="smtplib: SMTP protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">smtplib</span></code></a></dt><dd><p>SMTP (Simple Mail Transport Protocol) client</p>
|
|
</dd>
|
|
<dt>Module <a class="reference internal" href="poplib.html#module-poplib" title="poplib: POP3 protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">poplib</span></code></a></dt><dd><p>POP (Post Office Protocol) client</p>
|
|
</dd>
|
|
<dt>Module <a class="reference internal" href="imaplib.html#module-imaplib" title="imaplib: IMAP4 protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">imaplib</span></code></a></dt><dd><p>IMAP (Internet Message Access Protocol) client</p>
|
|
</dd>
|
|
<dt>Module <a class="reference internal" href="mailbox.html#module-mailbox" title="mailbox: Manipulate mailboxes in various formats"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mailbox</span></code></a></dt><dd><p>Tools for creating, reading, and managing collections of messages on disk
|
|
using a variety standard formats.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<div class="clearer"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
<div class="sphinxsidebarwrapper">
|
|
<div>
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="netdata.html"
|
|
title="previous chapter">Internet Data Handling</a></p>
|
|
</div>
|
|
<div>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="email.message.html"
|
|
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.message</span></code>: Representing an email message</a></p>
|
|
</div>
|
|
<div role="note" aria-label="source link">
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
<li>
|
|
<a href="https://github.com/python/cpython/blob/main/Doc/library/email.rst"
|
|
rel="nofollow">Show Source
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div id="sidebarbutton" title="Collapse sidebar">
|
|
<span>«</span>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="related" role="navigation" aria-label="Related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="../genindex.html" title="General Index"
|
|
>index</a></li>
|
|
<li class="right" >
|
|
<a href="../py-modindex.html" title="Python Module Index"
|
|
>modules</a> |</li>
|
|
<li class="right" >
|
|
<a href="email.message.html" title="email.message: Representing an email message"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="netdata.html" title="Internet Data Handling"
|
|
>previous</a> |</li>
|
|
|
|
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
<li class="switchers">
|
|
<div class="language_switcher_placeholder"></div>
|
|
<div class="version_switcher_placeholder"></div>
|
|
</li>
|
|
<li>
|
|
|
|
</li>
|
|
<li id="cpython-language-and-version">
|
|
<a href="../index.html">3.13.3 Documentation</a> »
|
|
</li>
|
|
|
|
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
|
|
<li class="nav-item nav-item-2"><a href="netdata.html" >Internet Data Handling</a> »</li>
|
|
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code> — An email and MIME handling package</a></li>
|
|
<li class="right">
|
|
|
|
|
|
<div class="inline-search" role="search">
|
|
<form class="inline-search" action="../search.html" method="get">
|
|
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
<input type="submit" value="Go" />
|
|
</form>
|
|
</div>
|
|
|
|
|
</li>
|
|
<li class="right">
|
|
<label class="theme-selector-label">
|
|
Theme
|
|
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
<option value="auto" selected>Auto</option>
|
|
<option value="light">Light</option>
|
|
<option value="dark">Dark</option>
|
|
</select>
|
|
</label> |</li>
|
|
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
©
|
|
<a href="../copyright.html">
|
|
|
|
Copyright
|
|
|
|
</a>
|
|
2001-2025, Python Software Foundation.
|
|
<br />
|
|
This page is licensed under the Python Software Foundation License Version 2.
|
|
<br />
|
|
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
<br />
|
|
|
|
See <a href="/license.html">History and License</a> for more information.<br />
|
|
|
|
|
|
<br />
|
|
|
|
The Python Software Foundation is a non-profit corporation.
|
|
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
<br />
|
|
<br />
|
|
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
|
|
<a href="/bugs.html">Found a bug</a>?
|
|
|
|
<br />
|
|
|
|
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
</div>
|
|
|
|
</body>
|
|
</html> |