gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

441 line
33KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="email — An email and MIME handling package" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/email.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <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..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <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..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>email — An email and MIME handling package &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="email.message: Representing an email message" href="email.message.html" />
  33. <link rel="prev" title="Internet Data Handling" href="netdata.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/email.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <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>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h4>Previous topic</h4>
  84. <p class="topless"><a href="netdata.html"
  85. title="previous chapter">Internet Data Handling</a></p>
  86. </div>
  87. <div>
  88. <h4>Next topic</h4>
  89. <p class="topless"><a href="email.message.html"
  90. 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>
  91. </div>
  92. <div role="note" aria-label="source link">
  93. <h3>This Page</h3>
  94. <ul class="this-page-menu">
  95. <li><a href="../bugs.html">Report a Bug</a></li>
  96. <li>
  97. <a href="https://github.com/python/cpython/blob/main/Doc/library/email.rst"
  98. rel="nofollow">Show Source
  99. </a>
  100. </li>
  101. </ul>
  102. </div>
  103. </nav>
  104. </div>
  105. </div>
  106. <div class="related" role="navigation" aria-label="related navigation">
  107. <h3>Navigation</h3>
  108. <ul>
  109. <li class="right" style="margin-right: 10px">
  110. <a href="../genindex.html" title="General Index"
  111. accesskey="I">index</a></li>
  112. <li class="right" >
  113. <a href="../py-modindex.html" title="Python Module Index"
  114. >modules</a> |</li>
  115. <li class="right" >
  116. <a href="email.message.html" title="email.message: Representing an email message"
  117. accesskey="N">next</a> |</li>
  118. <li class="right" >
  119. <a href="netdata.html" title="Internet Data Handling"
  120. accesskey="P">previous</a> |</li>
  121. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  122. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  123. <li class="switchers">
  124. <div class="language_switcher_placeholder"></div>
  125. <div class="version_switcher_placeholder"></div>
  126. </li>
  127. <li>
  128. </li>
  129. <li id="cpython-language-and-version">
  130. <a href="../index.html">3.12.3 Documentation</a> &#187;
  131. </li>
  132. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  133. <li class="nav-item nav-item-2"><a href="netdata.html" accesskey="U">Internet Data Handling</a> &#187;</li>
  134. <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>
  135. <li class="right">
  136. <div class="inline-search" role="search">
  137. <form class="inline-search" action="../search.html" method="get">
  138. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  139. <input type="submit" value="Go" />
  140. </form>
  141. </div>
  142. |
  143. </li>
  144. <li class="right">
  145. <label class="theme-selector-label">
  146. Theme
  147. <select class="theme-selector" oninput="activateTheme(this.value)">
  148. <option value="auto" selected>Auto</option>
  149. <option value="light">Light</option>
  150. <option value="dark">Dark</option>
  151. </select>
  152. </label> |</li>
  153. </ul>
  154. </div>
  155. <div class="document">
  156. <div class="documentwrapper">
  157. <div class="bodywrapper">
  158. <div class="body" role="main">
  159. <section id="module-email">
  160. <span id="email-an-email-and-mime-handling-package"></span><h1><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> — An email and MIME handling package<a class="headerlink" href="#module-email" title="Link to this heading">¶</a></h1>
  161. <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/email/__init__.py">Lib/email/__init__.py</a></p>
  162. <hr class="docutils" />
  163. <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
  164. specifically <em>not</em> designed to do any sending of email messages to SMTP
  165. (<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
  166. <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> and <a class="reference internal" href="nntplib.html#module-nntplib" title="nntplib: NNTP protocol client (requires sockets). (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">nntplib</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
  167. 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
  168. 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>,
  169. 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>
  170. <p>The overall structure of the email package can be divided into three major
  171. components, plus a fourth component that controls the behavior of the other
  172. components.</p>
  173. <p>The central component of the package is an “object model” that represents email
  174. messages. An application interacts with the package primarily through the
  175. 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
  176. application can use this API to ask questions about an existing email, to
  177. construct a new email, or to add or remove email subcomponents that themselves
  178. use the same object model interface. That is, following the nature of email
  179. messages and their MIME subcomponents, the email object model is a tree
  180. 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>
  181. API.</p>
  182. <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
  183. 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
  184. email message (a stream of bytes) and converts it into a tree of
  185. <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
  186. <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
  187. stream. (The parser and generator also handle streams of text characters, but
  188. this usage is discouraged as it is too easy to end up with messages that are
  189. not valid in one way or another.)</p>
  190. <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
  191. <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
  192. <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
  193. controls its behavior. Usually an application only needs to specify the policy
  194. 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
  195. 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,
  196. 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
  197. 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>.
  198. This allows, for example, a generic email message to be parsed from disk, but
  199. to serialize it using standard SMTP settings when sending it to an email
  200. server.</p>
  201. <p>The email package does its best to hide the details of the various governing
  202. RFCs from the application. Conceptually the application should be able to
  203. treat the email message as a structured tree of unicode text and binary
  204. attachments, without having to worry about how these are represented when
  205. serialized. In practice, however, it is often necessary to be aware of at
  206. least some of the rules governing MIME messages and their structure,
  207. specifically the names and nature of the MIME “content types” and how they
  208. identify multipart documents. For the most part this knowledge should only be
  209. required for more complex applications, and even then it should only be the
  210. high level structure in question, and not the details of how those structures
  211. are represented. Since MIME content types are used widely in modern internet
  212. software (not just email), this will be a familiar concept to many programmers.</p>
  213. <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.
  214. 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
  215. interface an application will use, and follow that with the
  216. <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
  217. <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
  218. components of the library.</p>
  219. <p>The next three sections cover the exceptions the package may raise and the
  220. 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
  221. 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
  222. <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
  223. detailed manipulation of headers and payloads, respectively. Both of these
  224. components contain features relevant to consuming and producing non-trivial
  225. messages, but also document their extensibility APIs, which will be of interest
  226. to advanced applications.</p>
  227. <p>Following those is a set of examples of using the fundamental parts of the APIs
  228. covered in the preceding sections.</p>
  229. <p>The foregoing represent the modern (unicode friendly) API of the email package.
  230. 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>
  231. 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
  232. directly with the details of how email messages are represented. The
  233. <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
  234. the application, but for applications that need to operate at that level, they
  235. can be useful tools. This documentation is also relevant for applications that
  236. 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
  237. compatibility reasons.</p>
  238. <div class="versionchanged">
  239. <p><span class="versionmodified changed">Changed in version 3.6: </span>Docs reorganized and rewritten to promote the new
  240. <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>
  241. API.</p>
  242. </div>
  243. <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>
  244. <div class="toctree-wrapper compound">
  245. <ul>
  246. <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>
  247. <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>
  248. <li class="toctree-l2"><a class="reference internal" href="email.parser.html#feedparser-api">FeedParser API</a></li>
  249. <li class="toctree-l2"><a class="reference internal" href="email.parser.html#parser-api">Parser API</a></li>
  250. <li class="toctree-l2"><a class="reference internal" href="email.parser.html#additional-notes">Additional notes</a></li>
  251. </ul>
  252. </li>
  253. <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>
  254. <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>
  255. <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>
  256. <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>
  257. <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>
  258. <li class="toctree-l2"><a class="reference internal" href="email.contentmanager.html#content-manager-instances">Content Manager Instances</a></li>
  259. </ul>
  260. </li>
  261. <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>
  262. </ul>
  263. </div>
  264. <p>Legacy API:</p>
  265. <div class="toctree-wrapper compound">
  266. <ul>
  267. <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>
  268. <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>
  269. <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>
  270. <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>
  271. <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>
  272. <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>
  273. <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>
  274. </ul>
  275. </div>
  276. <div class="admonition seealso">
  277. <p class="admonition-title">See also</p>
  278. <dl class="simple">
  279. <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>
  280. </dd>
  281. <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>
  282. </dd>
  283. <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>
  284. </dd>
  285. <dt>Module <a class="reference internal" href="nntplib.html#module-nntplib" title="nntplib: NNTP protocol client (requires sockets). (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">nntplib</span></code></a></dt><dd><p>NNTP (Net News Transport Protocol) client</p>
  286. </dd>
  287. <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
  288. using a variety standard formats.</p>
  289. </dd>
  290. </dl>
  291. </div>
  292. </section>
  293. <div class="clearer"></div>
  294. </div>
  295. </div>
  296. </div>
  297. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  298. <div class="sphinxsidebarwrapper">
  299. <div>
  300. <h4>Previous topic</h4>
  301. <p class="topless"><a href="netdata.html"
  302. title="previous chapter">Internet Data Handling</a></p>
  303. </div>
  304. <div>
  305. <h4>Next topic</h4>
  306. <p class="topless"><a href="email.message.html"
  307. 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>
  308. </div>
  309. <div role="note" aria-label="source link">
  310. <h3>This Page</h3>
  311. <ul class="this-page-menu">
  312. <li><a href="../bugs.html">Report a Bug</a></li>
  313. <li>
  314. <a href="https://github.com/python/cpython/blob/main/Doc/library/email.rst"
  315. rel="nofollow">Show Source
  316. </a>
  317. </li>
  318. </ul>
  319. </div>
  320. </div>
  321. <div id="sidebarbutton" title="Collapse sidebar">
  322. <span>«</span>
  323. </div>
  324. </div>
  325. <div class="clearer"></div>
  326. </div>
  327. <div class="related" role="navigation" aria-label="related navigation">
  328. <h3>Navigation</h3>
  329. <ul>
  330. <li class="right" style="margin-right: 10px">
  331. <a href="../genindex.html" title="General Index"
  332. >index</a></li>
  333. <li class="right" >
  334. <a href="../py-modindex.html" title="Python Module Index"
  335. >modules</a> |</li>
  336. <li class="right" >
  337. <a href="email.message.html" title="email.message: Representing an email message"
  338. >next</a> |</li>
  339. <li class="right" >
  340. <a href="netdata.html" title="Internet Data Handling"
  341. >previous</a> |</li>
  342. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  343. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  344. <li class="switchers">
  345. <div class="language_switcher_placeholder"></div>
  346. <div class="version_switcher_placeholder"></div>
  347. </li>
  348. <li>
  349. </li>
  350. <li id="cpython-language-and-version">
  351. <a href="../index.html">3.12.3 Documentation</a> &#187;
  352. </li>
  353. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  354. <li class="nav-item nav-item-2"><a href="netdata.html" >Internet Data Handling</a> &#187;</li>
  355. <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>
  356. <li class="right">
  357. <div class="inline-search" role="search">
  358. <form class="inline-search" action="../search.html" method="get">
  359. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  360. <input type="submit" value="Go" />
  361. </form>
  362. </div>
  363. |
  364. </li>
  365. <li class="right">
  366. <label class="theme-selector-label">
  367. Theme
  368. <select class="theme-selector" oninput="activateTheme(this.value)">
  369. <option value="auto" selected>Auto</option>
  370. <option value="light">Light</option>
  371. <option value="dark">Dark</option>
  372. </select>
  373. </label> |</li>
  374. </ul>
  375. </div>
  376. <div class="footer">
  377. &copy;
  378. <a href="../copyright.html">
  379. Copyright
  380. </a>
  381. 2001-2024, Python Software Foundation.
  382. <br />
  383. This page is licensed under the Python Software Foundation License Version 2.
  384. <br />
  385. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  386. <br />
  387. See <a href="/license.html">History and License</a> for more information.<br />
  388. <br />
  389. The Python Software Foundation is a non-profit corporation.
  390. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  391. <br />
  392. <br />
  393. Last updated on Apr 09, 2024 (13:47 UTC).
  394. <a href="/bugs.html">Found a bug</a>?
  395. <br />
  396. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  397. </div>
  398. </body>
  399. </html>
上海开阖软件有限公司 沪ICP备12045867号-1