Kerala Cyber
Warriors
KCW Uploader V1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>18.9. mimify — MIME processing of mail messages — Python 2.7.18 documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 2.7.18 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="18.10. multifile — Support for files containing distinct parts" href="multifile.html" />
<link rel="prev" title="18.8. MimeWriter — Generic MIME file writer" href="mimewriter.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<link rel="canonical" href="file:///usr/share/doc/python2.7/html/library/mimify.html" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
</head><body>
<div id="outdated-warning" style="padding: .5em; text-align: center; background-color: #FFBABA; color: #6A0E0E;">
This document is for an old version of Python that is <a href="https://devguide.python.org/devcycle/#end-of-life-branches">no longer supported</a>.
You should install the python3 and python3-doc packages and read the
<a href="file:///usr/share/doc/python3-doc/html/library/mimify.html"> Python documentation for the Python3 version packaged in this release</a>.
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="multifile.html" title="18.10. multifile — Support for files containing distinct parts"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="mimewriter.html" title="18.8. MimeWriter — Generic MIME file writer"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.18 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">18. Internet Data Handling</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-mimify">
<span id="mimify-mime-processing-of-mail-messages"></span><h1>18.9. <a class="reference internal" href="#module-mimify" title="mimify: Mimification and unmimification of mail messages. (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mimify</span></code></a> — MIME processing of mail messages<a class="headerlink" href="#module-mimify" title="Permalink to this headline">¶</a></h1>
<div class="deprecated">
<p><span class="versionmodified">Deprecated since version 2.3: </span>The <a class="reference internal" href="email.html#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages, including MIME documents."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package should be used in preference to the <a class="reference internal" href="#module-mimify" title="mimify: Mimification and unmimification of mail messages. (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mimify</span></code></a>
module. This module is present only to maintain backward compatibility.</p>
</div>
<p>The <a class="reference internal" href="#module-mimify" title="mimify: Mimification and unmimification of mail messages. (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mimify</span></code></a> module defines two functions to convert mail messages to and
from MIME format. The mail message can be either a simple message or a
so-called multipart message. Each part is treated separately. Mimifying (a part
of) a message entails encoding the message as quoted-printable if it contains
any characters that cannot be represented using 7-bit ASCII. Unmimifying (a
part of) a message entails undoing the quoted-printable encoding. Mimify and
unmimify are especially useful when a message has to be edited before being
sent. Typical use would be:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">unmimify</span> <span class="n">message</span>
<span class="n">edit</span> <span class="n">message</span>
<span class="n">mimify</span> <span class="n">message</span>
<span class="n">send</span> <span class="n">message</span>
</pre></div>
</div>
<p>The modules defines the following user-callable functions and user-settable
variables:</p>
<dl class="function">
<dt id="mimify.mimify">
<code class="descclassname">mimify.</code><code class="descname">mimify</code><span class="sig-paren">(</span><em>infile</em>, <em>outfile</em><span class="sig-paren">)</span><a class="headerlink" href="#mimify.mimify" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy the message in <em>infile</em> to <em>outfile</em>, converting parts to quoted-printable
and adding MIME mail headers when necessary. <em>infile</em> and <em>outfile</em> can be file
objects (actually, any object that has a <a class="reference internal" href="readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">readline()</span></code></a> method (for <em>infile</em>)
or a <code class="xref py py-meth docutils literal notranslate"><span class="pre">write()</span></code> method (for <em>outfile</em>)) or strings naming the files. If
<em>infile</em> and <em>outfile</em> are both strings, they may have the same value.</p>
</dd></dl>
<dl class="function">
<dt id="mimify.unmimify">
<code class="descclassname">mimify.</code><code class="descname">unmimify</code><span class="sig-paren">(</span><em>infile</em>, <em>outfile</em><span class="optional">[</span>, <em>decode_base64</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#mimify.unmimify" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy the message in <em>infile</em> to <em>outfile</em>, decoding all quoted-printable parts.
<em>infile</em> and <em>outfile</em> can be file objects (actually, any object that has a
<a class="reference internal" href="readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal notranslate"><span class="pre">readline()</span></code></a> method (for <em>infile</em>) or a <code class="xref py py-meth docutils literal notranslate"><span class="pre">write()</span></code> method (for
<em>outfile</em>)) or strings naming the files. If <em>infile</em> and <em>outfile</em> are both
strings, they may have the same value. If the <em>decode_base64</em> argument is
provided and tests true, any parts that are coded in the base64 encoding are
decoded as well.</p>
</dd></dl>
<dl class="function">
<dt id="mimify.mime_decode_header">
<code class="descclassname">mimify.</code><code class="descname">mime_decode_header</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#mimify.mime_decode_header" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a decoded version of the encoded header line in <em>line</em>. This only
supports the ISO 8859-1 charset (Latin-1).</p>
</dd></dl>
<dl class="function">
<dt id="mimify.mime_encode_header">
<code class="descclassname">mimify.</code><code class="descname">mime_encode_header</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#mimify.mime_encode_header" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a MIME-encoded version of the header line in <em>line</em>.</p>
</dd></dl>
<dl class="data">
<dt id="mimify.MAXLEN">
<code class="descclassname">mimify.</code><code class="descname">MAXLEN</code><a class="headerlink" href="#mimify.MAXLEN" title="Permalink to this definition">¶</a></dt>
<dd><p>By default, a part will be encoded as quoted-printable when it contains any
non-ASCII characters (characters with the 8th bit set), or if there are any
lines longer than <a class="reference internal" href="#mimify.MAXLEN" title="mimify.MAXLEN"><code class="xref py py-const docutils literal notranslate"><span class="pre">MAXLEN</span></code></a> characters (default value 200).</p>
</dd></dl>
<dl class="data">
<dt id="mimify.CHARSET">
<code class="descclassname">mimify.</code><code class="descname">CHARSET</code><a class="headerlink" href="#mimify.CHARSET" title="Permalink to this definition">¶</a></dt>
<dd><p>When not specified in the mail headers, a character set must be filled in. The
string used is stored in <a class="reference internal" href="#mimify.CHARSET" title="mimify.CHARSET"><code class="xref py py-const docutils literal notranslate"><span class="pre">CHARSET</span></code></a>, and the default value is ISO-8859-1
(also known as Latin1 (latin-one)).</p>
</dd></dl>
<p>This module can also be used from the command line. Usage is as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mimify</span><span class="o">.</span><span class="n">py</span> <span class="o">-</span><span class="n">e</span> <span class="p">[</span><span class="o">-</span><span class="n">l</span> <span class="n">length</span><span class="p">]</span> <span class="p">[</span><span class="n">infile</span> <span class="p">[</span><span class="n">outfile</span><span class="p">]]</span>
<span class="n">mimify</span><span class="o">.</span><span class="n">py</span> <span class="o">-</span><span class="n">d</span> <span class="p">[</span><span class="o">-</span><span class="n">b</span><span class="p">]</span> <span class="p">[</span><span class="n">infile</span> <span class="p">[</span><span class="n">outfile</span><span class="p">]]</span>
</pre></div>
</div>
<p>to encode (mimify) and decode (unmimify) respectively. <em>infile</em> defaults to
standard input, <em>outfile</em> defaults to standard output. The same file can be
specified for input and output.</p>
<p>If the <strong>-l</strong> option is given when encoding, if there are any lines longer than
the specified <em>length</em>, the containing part will be encoded.</p>
<p>If the <strong>-b</strong> option is given when decoding, any base64 parts will be decoded as
well.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt>Module <a class="reference internal" href="quopri.html#module-quopri" title="quopri: Encode and decode files using the MIME quoted-printable encoding."><code class="xref py py-mod docutils literal notranslate"><span class="pre">quopri</span></code></a></dt>
<dd>Encode and decode MIME quoted-printable files.</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="mimewriter.html"
title="previous chapter">18.8. <code class="docutils literal notranslate"><span class="pre">MimeWriter</span></code> — Generic MIME file writer</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="multifile.html"
title="next chapter">18.10. <code class="docutils literal notranslate"><span class="pre">multifile</span></code> — Support for files containing distinct parts</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/library/mimify.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="multifile.html" title="18.10. multifile — Support for files containing distinct parts"
>next</a> |</li>
<li class="right" >
<a href="mimewriter.html" title="18.8. MimeWriter — Generic MIME file writer"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.18 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" >18. Internet Data Handling</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2024, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on November 21, 2024.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.8.5.
</div>
</body>
</html>
-=[ KCW uplo4d3r c0ded by cJ_n4p573r ]=-
Ⓒ2017 ҠЄГѦLѦ СүѣЄГ ЩѦГГіѺГՏ